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:
@@ -1,5 +1,6 @@
|
||||
# Build stage
|
||||
FROM rust:1.85-alpine AS builder
|
||||
ARG DOCKER_MIRROR=""
|
||||
FROM ${DOCKER_MIRROR}rust:1.85-alpine AS builder
|
||||
|
||||
# Use Aliyun mirrors for faster package downloads in China
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
@@ -40,7 +41,7 @@ RUN touch src/main.rs migration/src/main.rs migration/src/lib.rs
|
||||
RUN cargo build --release
|
||||
|
||||
# Runtime stage
|
||||
FROM alpine:3.21
|
||||
FROM ${DOCKER_MIRROR}alpine:3.21
|
||||
|
||||
# Use Aliyun mirrors
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
|
||||
Reference in New Issue
Block a user