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