更换加速地址.腾讯云-阿里云
This commit is contained in:
+15
-6
@@ -3,17 +3,22 @@ FROM node:20-slim AS frontend-builder
|
||||
|
||||
WORKDIR /build
|
||||
COPY web/frontend/package.json web/frontend/package-lock.json* ./
|
||||
RUN npm ci || npm install
|
||||
# 优先 npmmirror,失败时回退官方 registry
|
||||
RUN npm config set registry https://registry.npmmirror.com && \
|
||||
(npm ci || npm install) || \
|
||||
(npm config set registry https://registry.npmjs.org && (npm ci || npm install))
|
||||
COPY web/frontend/ ./
|
||||
RUN npm run build
|
||||
|
||||
# ===== 阶段2: Python 运行时 =====
|
||||
FROM python:3.12-slim AS runtime
|
||||
|
||||
# 优先使用腾讯云镜像源加速;不可用时自动回退官方源。
|
||||
# 优先阿里云内网镜像,其次公网阿里云,最后官方源。
|
||||
RUN cp /etc/apt/sources.list.d/debian.sources /tmp/debian.sources && \
|
||||
sed -i 's/deb.debian.org/mirrors.tencentyun.com/g' /etc/apt/sources.list.d/debian.sources && \
|
||||
sed -i 's/deb.debian.org/mirrors.cloud.aliyuncs.com/g' /etc/apt/sources.list.d/debian.sources && \
|
||||
(apt-get update -o APT::Update::Error-Mode=any || \
|
||||
(sed -i 's/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources && \
|
||||
apt-get update -o APT::Update::Error-Mode=any) || \
|
||||
(cp /tmp/debian.sources /etc/apt/sources.list.d/debian.sources && \
|
||||
apt-get update -o APT::Update::Error-Mode=any)) && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
@@ -22,15 +27,19 @@ RUN cp /etc/apt/sources.list.d/debian.sources /tmp/debian.sources && \
|
||||
nodejs \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 安装 uv:优先腾讯云 PyPI,失败时回退默认 PyPI。
|
||||
RUN pip install -i https://mirrors.tencentyun.com/pypi/simple uv || pip install uv
|
||||
# 安装 uv:优先阿里云内网 PyPI → 公网阿里云 → 官方。
|
||||
RUN pip install -i https://mirrors.cloud.aliyuncs.com/pypi/simple/ uv || \
|
||||
pip install -i https://mirrors.aliyun.com/pypi/simple/ uv || \
|
||||
pip install uv
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 先复制依赖文件,利用 Docker 缓存层
|
||||
COPY pyproject.toml uv.lock* README.md alembic.ini ./
|
||||
RUN uv venv /app/.venv && \
|
||||
(UV_INDEX_URL=https://mirrors.tencentyun.com/pypi/simple uv pip install -e . || uv pip install -e .)
|
||||
(UV_INDEX_URL=https://mirrors.cloud.aliyuncs.com/pypi/simple/ uv pip install -e . || \
|
||||
UV_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/ uv pip install -e . || \
|
||||
uv pip install -e .)
|
||||
|
||||
# 复制项目代码
|
||||
COPY core/ ./core/
|
||||
|
||||
Reference in New Issue
Block a user