# 后端 Dockerfile FROM python:3.12-slim # 设置工作目录 WORKDIR /app # 安装系统依赖 RUN apt-get update && apt-get install -y \ gcc \ g++ \ curl \ && rm -rf /var/lib/apt/lists/* # 复制依赖文件 COPY requirements.txt . # 安装 Python 依赖 清华园镜像源 RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple # 复制项目代码 COPY src/ ./src/ COPY static/ ./static/ COPY assets/ ./assets/ # 创建必要的目录 RUN mkdir -p /app/assets/saves /app/logs # 暴露端口 EXPOSE 8002 # 启动命令 CMD ["uvicorn", "src.server.main:app", "--host", "0.0.0.0", "--port", "8002"]