build(Dockerfile): 更新基础镜像源为国内镜像站

将基础镜像源从华为云镜像站更新为中国科技大学镜像站,以提高国内构建速度
This commit is contained in:
zhouyonggao 2025-12-02 16:47:05 +08:00
parent 924ea7f7f8
commit 31f288bb1e
1 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,6 @@
ARG BASE_REGISTRY=repo.huaweicloud.com
FROM repo.huaweicloud.com/dockerhub/library/golang:1.21-alpine AS build
ARG BASE_REGISTRY=docker.mirrors.ustc.edu.cn
FROM ${BASE_REGISTRY}/library/golang:1.21-alpine AS build
ARG ALPINE_MIRROR=mirrors.ustc.edu.cn
RUN sed -i "s/dl-cdn.alpinelinux.org/${ALPINE_MIRROR}/g" /etc/apk/repositories || true
ARG GOPROXY=https://goproxy.cn,direct
ENV GOPROXY=$GOPROXY
@ -10,7 +11,8 @@ COPY web/ ./web/
WORKDIR /app/server
RUN go env -w GOPROXY=$GOPROXY && go build -o /app/bin/marketing-data-server ./cmd/server
FROM ${BASE_REGISTRY}/dockerhub/library/alpine:3.19
FROM ${BASE_REGISTRY}/library/alpine:3.19
ARG ALPINE_MIRROR=mirrors.ustc.edu.cn
RUN sed -i "s/dl-cdn.alpinelinux.org/${ALPINE_MIRROR}/g" /etc/apk/repositories || true
WORKDIR /app
COPY --from=build /app/bin/marketing-data-server /app/bin/marketing-data-server