From 9320f02cf3355045c9cc22392e52927b4b9c29e7 Mon Sep 17 00:00:00 2001 From: aipper Date: Mon, 2 Mar 2026 11:04:19 +0800 Subject: [PATCH] fix: default npm registry mirror for docker build --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 405bf5b..8d2a37e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ WORKDIR /app # 可选:使用哪种包管理器构建(默认 pnpm;也可传 npm) ARG PKG_MANAGER=pnpm # 可选:镜像加速(例如 https://registry.npmmirror.com) -ARG NPM_REGISTRY= +ARG NPM_REGISTRY=https://registry.npmmirror.com ENV CI=true @@ -19,7 +19,9 @@ RUN if [ -n "$NPM_REGISTRY" ]; then npm config set registry "$NPM_REGISTRY"; fi RUN set -eux; \ if [ "$PKG_MANAGER" = "pnpm" ]; then \ - npm i -g pnpm@9 && pnpm i --frozen-lockfile; \ + npm i -g pnpm@9; \ + if [ -n "$NPM_REGISTRY" ]; then pnpm config set registry "$NPM_REGISTRY"; fi; \ + pnpm i --frozen-lockfile; \ elif [ "$PKG_MANAGER" = "npm" ]; then \ npm ci --no-audit --fund=false; \ else \