|
|
@@ -1,16 +1,22 @@
|
|
|
+# 国内 Jenkins 默认走阿里云镜像,避免拉取 docker.io 超时
|
|
|
+# 可覆盖: docker build --build-arg NODE_IMAGE=node:20-alpine ...
|
|
|
+ARG NODE_IMAGE=registry.cn-hangzhou.aliyuncs.com/library/node:20-alpine
|
|
|
+ARG PYTHON_IMAGE=registry.cn-hangzhou.aliyuncs.com/library/python:3.11-slim
|
|
|
+
|
|
|
# Stage 1: build frontend
|
|
|
-FROM node:20-alpine AS web-builder
|
|
|
+FROM ${NODE_IMAGE} AS web-builder
|
|
|
|
|
|
WORKDIR /app/web
|
|
|
|
|
|
COPY web/package.json web/package-lock.json ./
|
|
|
-RUN npm ci
|
|
|
+RUN npm config set registry https://registry.npmmirror.com \
|
|
|
+ && npm ci
|
|
|
|
|
|
COPY web/ ./
|
|
|
RUN npm run build
|
|
|
|
|
|
# Stage 2: Python runtime
|
|
|
-FROM python:3.11-slim
|
|
|
+FROM ${PYTHON_IMAGE}
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
@@ -19,6 +25,9 @@ ENV PYTHONUNBUFFERED=1 \
|
|
|
PIP_NO_CACHE_DIR=1 \
|
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
|
|
|
|
+RUN sed -i 's|deb.debian.org|mirrors.aliyun.com|g; s|security.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources 2>/dev/null || \
|
|
|
+ sed -i 's|deb.debian.org|mirrors.aliyun.com|g; s|security.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list 2>/dev/null || true
|
|
|
+
|
|
|
RUN apt-get update \
|
|
|
&& apt-get install -y --no-install-recommends gcc \
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
@@ -30,7 +39,7 @@ COPY agents/ agents/
|
|
|
COPY api/ api/
|
|
|
COPY jobs/ jobs/
|
|
|
|
|
|
-RUN pip install ".[odps]"
|
|
|
+RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com ".[odps]"
|
|
|
|
|
|
COPY --from=web-builder /app/web/dist ./web/dist
|
|
|
|