build: pass module proxy to docker builder

This commit is contained in:
dela
2026-05-24 21:40:23 +08:00
parent 542eeefdbd
commit 6f4e7f04cc
6 changed files with 34 additions and 2 deletions

View File

@@ -1,8 +1,24 @@
FROM golang:1.23-alpine AS builder
ARG GOPROXY=https://proxy.golang.org,direct
ARG HTTP_PROXY
ARG HTTPS_PROXY
ARG NO_PROXY
ARG http_proxy
ARG https_proxy
ARG no_proxy
ENV GOPROXY=${GOPROXY} \
HTTP_PROXY=${HTTP_PROXY} \
HTTPS_PROXY=${HTTPS_PROXY} \
NO_PROXY=${NO_PROXY} \
http_proxy=${http_proxy} \
https_proxy=${https_proxy} \
no_proxy=${no_proxy}
WORKDIR /src
COPY go.mod go.sum* ./
RUN go mod download || true
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o /out/app ./cmd/app \
&& CGO_ENABLED=0 GOOS=linux go build -o /out/backfill ./cmd/backfill