From b72f1d7670a82fc30e20b399658d42a25f449990 Mon Sep 17 00:00:00 2001 From: kae Date: Mon, 6 Jul 2026 00:20:40 +0900 Subject: [PATCH] feat(deploy): parameterize registry and mirror via ARG for cross-region builds Convert hardcoded BASE_REGISTRY, APK_MIRROR, and NPM_REGISTRY values to ARG in both builder and runtime stages. CI defaults (Harbor + Aliyun + npmmirror) remain in Dockerfile ARG defaults; overseas builds override via --build-arg. --- Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4f9788b..d53f41f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,21 @@ ARG BASE_REGISTRY=harbor-in-k3s.cheverjohn.me/library FROM ${BASE_REGISTRY}/node:20-alpine AS builder +ARG APK_MIRROR=mirrors.aliyun.com +ARG NPM_REGISTRY=https://registry.npmmirror.com -RUN sed -i "s|dl-cdn.alpinelinux.org|mirrors.aliyun.com|g" /etc/apk/repositories +RUN [ -n "$APK_MIRROR" ] && sed -i "s|dl-cdn.alpinelinux.org|${APK_MIRROR}|g" /etc/apk/repositories || true RUN corepack enable && corepack prepare pnpm@9 --activate WORKDIR /app COPY package.json pnpm-lock.yaml ./ -RUN pnpm install --frozen-lockfile --registry=https://registry.npmmirror.com +RUN pnpm install --frozen-lockfile --registry=${NPM_REGISTRY} COPY . . RUN pnpm build FROM ${BASE_REGISTRY}/nginx:1.27-alpine -RUN sed -i "s|dl-cdn.alpinelinux.org|mirrors.aliyun.com|g" /etc/apk/repositories +ARG APK_MIRROR=mirrors.aliyun.com +RUN [ -n "$APK_MIRROR" ] && sed -i "s|dl-cdn.alpinelinux.org|${APK_MIRROR}|g" /etc/apk/repositories || true COPY --from=builder /app/dist /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf