Add configurable Docker mirror for China network builds

Add DOCKER_MIRROR build arg to Dockerfiles so base images can be
pulled through a mirror registry (e.g. docker.1ms.run/) when Docker
Hub is unreachable. Defaults to empty (direct Docker Hub).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Michael Dong
2026-02-11 13:44:04 +08:00
parent 730cf6c738
commit f34c01afdf
3 changed files with 9 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
# Build stage
FROM node:20-alpine AS builder
ARG DOCKER_MIRROR=""
FROM ${DOCKER_MIRROR}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
@@ -29,7 +30,7 @@ RUN mkdir -p public
RUN npm run build
# Production stage
FROM node:20-alpine AS runner
FROM ${DOCKER_MIRROR}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