修复构建镜像问题

This commit is contained in:
brother7 committed 2026-08-15 19:16:54 +08:00
1 parent 9f40162c6b
commit af530a5fe3
2 files changed
+61 -1

No files matched your search

+7 -1
View File
@@ -6,6 +6,7 @@
# docker build -f backend/Dockerfile \
# --build-arg GOLANG_IMAGE=<working-mirror>/golang:1.21-alpine \
# --build-arg RUNTIME_IMAGE=<working-mirror>/alpine:3.20 \
# --build-arg GOPROXY=https://<internal-go-proxy>,direct \
# -t REGISTRY/PROJECT/zhinian-go-api:TAG backend/
#
# If no mirror can serve the golang image at all, use backend/Dockerfile.runtime
@@ -15,7 +16,12 @@ ARG RUNTIME_IMAGE=alpine:3.20
FROM ${GOLANG_IMAGE} AS build
WORKDIR /src
ENV CGO_ENABLED=0 GOOS=linux
ARG GOPROXY=https://goproxy.cn,direct
ARG GOSUMDB=sum.golang.google.cn
ENV CGO_ENABLED=0 \
GOOS=linux \
GOPROXY=${GOPROXY} \
GOSUMDB=${GOSUMDB}
COPY go.mod go.sum ./
RUN go mod download
COPY . .