diff --git a/Dockerfile b/Dockerfile index a0c03d6..c2d7fb1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,8 +5,9 @@ FROM python:3.11-slim WORKDIR /app # 安装系统依赖 -# build-essential 包含 gcc 等编译工具,某些 Python 包安装时需要 -RUN apt-get update && apt-get install -y --no-install-recommends \ +# 使用阿里云镜像源加速 apt-get 安装 +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 \ && rm -rf /var/lib/apt/lists/* @@ -14,7 +15,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY requirements.txt . # 安装 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 目录下 COPY . .