fix: 使用阿里云镜像源加速

This commit is contained in:
fuzhongyun 2026-01-28 14:33:20 +08:00
parent de547c9952
commit 8ce6633888
1 changed files with 5 additions and 3 deletions

View File

@ -5,8 +5,9 @@ FROM python:3.11-slim
WORKDIR /app WORKDIR /app
# 安装系统依赖 # 安装系统依赖
# build-essential 包含 gcc 等编译工具,某些 Python 包安装时需要 # 使用阿里云镜像源加速 apt-get 安装
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources \
&& apt-get update && apt-get install -y --no-install-recommends \
build-essential \ build-essential \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
@ -14,7 +15,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY requirements.txt . COPY requirements.txt .
# 安装 requirements.txt 中指定的 Python 包 # 安装 requirements.txt 中指定的 Python 包
RUN pip install --no-cache-dir -r requirements.txt # 使用阿里云 pip 镜像加速安装
RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
# 将当前目录内容复制到容器中的 /app 目录下 # 将当前目录内容复制到容器中的 /app 目录下
COPY . . COPY . .