- # 使用精简镜像,镜像体积从 1.2G 下降为约 400M,提高启动效率,同时升级到 Python 3.13.x 提高 20% 以上性能
- FROM python:3.13-slim-bullseye
- # 设置工作目录
- WORKDIR /app
- # 复制 requirements.txt 文件到工作目录
- COPY requirements.txt .
- # 升级 pip 到最新版
- RUN pip install pip --no-cache-dir -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com --upgrade
- # 根据requirements.txt 安装依赖
- RUN pip install --no-cache-dir -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com --upgrade
|