DPSA/Dockerfile
2025-05-06 20:27:07 +08:00

27 lines
592 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 使用官方Python轻量级镜像
FROM python:3.10-slim
# 设置工作目录
WORKDIR /app
# 配置国内镜像源(加速安装)
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# 先复制依赖文件利用Docker缓存优化
COPY requirements.txt .
# 安装依赖(禁用缓存减少体积)
RUN pip install --no-cache-dir -r requirements.txt
# 复制整个项目代码
COPY . .
# 暴露Flask默认端口
EXPOSE 5000
# 设置环境变量
ENV FLASK_APP=app/main.py
ENV FLASK_ENV=production
# 启动应用
CMD ["flask", "run", "--host=0.0.0.0"]