FROM python:3.11-slim # 安装系统依赖 RUN apt-get update && apt-get install -y \ fonts-wqy-microhei \ fonts-noto-cjk \ fonts-liberation \ fonts-dejavu \ libgomp1 \ libsm6 \ libxext6 \ libxrender-dev \ && rm -rf /var/lib/apt/lists/* # 设置工作目录 WORKDIR /app # 复制项目文件 COPY . . # 安装 Python 依赖 RUN pip install --no-cache-dir -r requirements.txt # 创建必要的目录 RUN mkdir -p uploads logs temp resource/fonts # 暴露端口 EXPOSE 60201 # 健康检查 HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://localhost:60201/health || exit 1 # 启动命令 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "60201"]