From 4ea0f163c35e17d87662096ced788ae40d4b28ff Mon Sep 17 00:00:00 2001 From: Michael Dong Date: Wed, 11 Feb 2026 11:27:23 +0800 Subject: [PATCH] Add China mirror sources to frontend Dockerfile Use Aliyun Alpine mirrors and npmmirror.com npm registry for faster builds on mainland China servers. Co-Authored-By: Claude Opus 4.6 --- frontend/Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 39709a6..89ef128 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,12 +1,18 @@ # Build stage FROM node:20-alpine AS builder +# Use Aliyun mirrors for Alpine packages +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories + WORKDIR /app # 构建参数(NEXT_PUBLIC_* 变量需要在构建时注入) ARG NEXT_PUBLIC_API_BASE ENV NEXT_PUBLIC_API_BASE=${NEXT_PUBLIC_API_BASE} +# Use China npm mirror +RUN npm config set registry https://registry.npmmirror.com + # Copy package files COPY package*.json ./ @@ -25,6 +31,9 @@ RUN npm run build # Production stage FROM node:20-alpine AS runner +# Use Aliyun mirrors for Alpine packages +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories + WORKDIR /app ENV NODE_ENV=production