Commit a83b9c45 by sunqi02 Committed by 胡悦

fix: 更新 Dockerfile,使用阿里云镜像源加速依赖安装

1 parent 74ff2acf
......@@ -6,8 +6,9 @@ ENV PYTHONUNBUFFERED=1 \
WORKDIR /app
# 安装系统依赖(如有需要编译的 Python 包)
RUN apt-get update && apt-get install -y --no-install-recommends \
# 安装系统依赖(使用阿里云 Debian 镜像源加速)
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 \
gfortran \
pkg-config \
......@@ -16,8 +17,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# 安装 Python 依赖(先拷贝 requirements 利用 Docker 缓存层)
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
&& PIP_NO_BINARY=numpy pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple/ \
&& PIP_NO_BINARY=numpy pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
# 拷贝项目文件(开发时会被 volume 覆盖)
COPY app/ ./app/
......
......@@ -3,8 +3,9 @@ FROM python:3.12-slim AS builder
WORKDIR /build
# 安装编译依赖
RUN apt-get update && apt-get install -y --no-install-recommends \
# 安装编译依赖(使用阿里云 Debian 镜像源加速)
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 \
gfortran \
pkg-config \
......@@ -13,8 +14,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# 安装 Python 依赖到指定目录(便于后续拷贝)
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
&& PIP_NO_BINARY=numpy pip install --no-cache-dir --prefix=/install -r requirements.txt
RUN pip install --no-cache-dir --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple/ \
&& PIP_NO_BINARY=numpy pip install --no-cache-dir --prefix=/install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
# ============ Stage 2: Runtime ============
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!