# 使用官方 Python 3.9 作为基础镜像 | |
FROM python:3.9 | |
# 设置工作目录 | |
WORKDIR /app | |
# 复制文件到容器 | |
COPY requirements.txt . | |
COPY main.py . | |
# 安装依赖 | |
RUN pip install --no-cache-dir -r requirements.txt | |
# 运行 FastAPI 服务器 | |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |