FROM python:3.11-slim WORKDIR /app # 复制 requirements.txt 并优先安装依赖(利用 Docker 层缓存) COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ # 复制整个项目 COPY . . EXPOSE 5000 # 确保模块名和 Flask 实例名正确(默认是 app:app) CMD ["gunicorn", "-w", "2", "-k", "gthread", "--threads", "4", "-b", "0.0.0.0:5000", "app:app"]