FROM python:3.9-slim WORKDIR /app # 安装依赖 COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # 复制代码 COPY app.py . # 暴露端口 EXPOSE 7860 # 使用 gunicorn 启动应用,将日志级别从 debug 改为 warning CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--timeout", "300", "--workers", "1", "--log-level", "warning", "app:app"]