# 使用Hugging Face提供的基础镜像 | |
FROM python:3.9-slim-buster | |
# 设置工作目录 | |
WORKDIR /app | |
# 安装Python依赖 | |
COPY requirements.txt /app/ | |
RUN pip install --no-cache-dir -r requirements.txt | |
# 拷贝项目文件到工作目录 | |
COPY . /app/ | |
# 公开 Hugging Face Spaces 需要的 8000 端口 | |
EXPOSE 8000 | |
# 运行启动脚本 (确保你有一个app.py文件) | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"] | |