FROM python:3.11-slim WORKDIR /app # 使用阿里云镜像源 RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ # 安装依赖 COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # 复制应用代码 COPY . . # 创建数据和日志目录 RUN mkdir -p data logs reports # 暴露端口 EXPOSE 8600 # 健康检查 HEALTHCHECK --interval=30s --timeout=10s --retries=3 \ CMD python -c "import httpx; httpx.get('http://localhost:8600/api/v1/health').raise_for_status()" # 启动命令 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8600"]