Spaces:
Sleeping
Sleeping
File size: 558 Bytes
a69f5f2 a26e689 2126d90 a26e689 db0f531 2126d90 a26e689 a69f5f2 a26e689 a69f5f2 a26e689 a69f5f2 a26e689 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
FROM python:3.9-slim
# 创建专用用户
RUN useradd -m -u 1000 appuser
# 设置工作目录
WORKDIR /app
# 安装系统依赖
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc python3-dev && \
rm -rf /var/lib/apt/lists/*
# 全局安装依赖
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 设置权限
RUN chown -R appuser:appuser /app
USER appuser
# 复制代码
COPY --chown=appuser:appuser . .
# 设置容器入口
ENTRYPOINT ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |