fix: default npm registry mirror for docker build

This commit is contained in:
2026-03-02 11:04:19 +08:00
parent 55396cf82d
commit 9320f02cf3

View File

@@ -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 \