File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -102,8 +102,10 @@ WORKDIR /go/src/app
102102ARG TARGETOS=linux
103103ARG TARGETARCH=arm64
104104ARG CGO_ENABLED=0
105+ ARG GOPROXY=direct
105106
106107COPY . .
108+ ENV GOPROXY=${GOPROXY}
107109RUN if [ -f go.mod ]; then go mod download; fi
108110
109111FROM base AS build
@@ -112,9 +114,11 @@ ARG TARGETOS=linux
112114ARG TARGETARCH=arm64
113115ARG CGO_ENABLED=0
114116ARG PACKAGE={{.Package}}
117+ ARG GOPROXY=direct
115118# -trimpath removes the absolute path to the source code in the binary
116119# -ldflags="-s -w" removes the symbol table and debug information from the binary
117120# CGO_ENABLED=0 disables the use of cgo
121+ ENV GOPROXY=${GOPROXY}
118122RUN CGO_ENABLED=${CGO_ENABLED} GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -ldflags="-s -w" -o /go/bin/app "${PACKAGE}"
119123
120124FROM debian:stable-slim
You can’t perform that action at this time.
0 commit comments