Dockerfile 651 B

12345678910111213141516171819202122232425262728293031
  1. FROM python:3.11-slim
  2. # 设置工作目录
  3. WORKDIR /app
  4. # 复制依赖文件
  5. COPY requirements.txt .
  6. COPY mirror_config.txt .
  7. # 设置清华镜像源(加速国内下载)
  8. RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
  9. pip config set global.trusted-host pypi.tuna.tsinghua.edu.cn
  10. # 安装 Python 依赖
  11. RUN pip install --no-cache-dir -r requirements.txt
  12. # 复制应用程序文件
  13. COPY wqb-server/ .
  14. # 创建必要的目录
  15. RUN mkdir -p templates static
  16. # 暴露 Flask 默认端口
  17. EXPOSE 5000
  18. # 设置环境变量
  19. ENV FLASK_APP=app.py
  20. ENV FLASK_ENV=production
  21. # 启动命令
  22. CMD ["python", "app.py"]