# 使用官方 Python 基础镜像 FROM python:3.11-slim # 设置工作目录 WORKDIR /app # 安装系统依赖(如果需要) #RUN apt-get update && apt-get install -y \ # build-essential \ # && rm -rf /var/lib/apt/lists/* # 复制项目文件 COPY . /app # 安装 Python 依赖 RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple # 暴露端口 EXPOSE 5000 # 启动命令(使用 Gunicorn 替代 Flask 开发服务器) CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "4", "--timeout", "300", "app:app"]