Dockerfile 571 B

1234567891011121314151617181920212223
  1. # 第一阶段:从国内镜像源拉取基础镜像
  2. FROM docker.m.daocloud.io/library/python:3.7 AS base
  3. # 第二阶段:实际构建
  4. FROM base
  5. # 设置工作目录
  6. WORKDIR /opt/mendunr
  7. # 设置pip的最大工作线程数
  8. ENV PIP_MAX_WORKERS=1
  9. # 将项目的依赖文件复制到工作目录
  10. COPY requirements.txt .
  11. # 升级pip并安装依赖,使用阿里云的镜像源
  12. RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
  13. # 将项目代码复制到工作目录
  14. COPY . .
  15. # 运行Python应用
  16. CMD ["python", "app.py"]