# 1. 基础镜像 FROM python:3.10-slim # 2. 工作目录 WORKDIR /app # 3. 复制依赖 COPY requirements.txt . # 4. 安装依赖 (清华源) RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple # 5. 复制文件 COPY . . # 6. 端口 EXPOSE 7860 # 7. 启动 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]