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