# 使用 Python 基础镜像 FROM python:3.12 # 设置工作目录 WORKDIR /app # 更换 pip 源为阿里云源 RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ # 复制项目文件 COPY requirements.txt . # 安装 Python 依赖 RUN pip install --no-cache-dir -r requirements.txt # 复制项目代码 COPY . . # 暴露端口 EXPOSE 8000 # 启动 FastAPI 应用 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5000"]