mirror of
https://github.com/dockersrc/go
synced 2026-06-24 14:01:08 -04:00
🔧 Add Go default env flags to build and final stages 🔧
- Dockerfile: add GOFLAGS=-buildvcs=false to prevent VCS stamp errors when users mount projects without a .git directory (Go 1.18+ default behaviour) - Dockerfile: add GOTELEMETRY=off to disable Go 1.23+ telemetry in containers - Dockerfile: add GOPROXY=https://proxy.golang.org,direct (explicit default, makes override via --env obvious) - Dockerfile: add GOBIN=/usr/local/bin to the final stage — was set in the build stage but missing from the scratch-based final stage; without it, go install inside the running container lands binaries in /usr/local/share/go/bin instead of /usr/local/bin Dockerfile
This commit is contained in:
@@ -88,6 +88,9 @@ ENV GOBIN="/usr/local/bin"
|
||||
ENV GOCACHE="/usr/local/share/go/cache"
|
||||
ENV CGO_ENABLED="0"
|
||||
ENV GOTOOLCHAIN="auto"
|
||||
ENV GOFLAGS="-buildvcs=false"
|
||||
ENV GOTELEMETRY="off"
|
||||
ENV GOPROXY="https://proxy.golang.org,direct"
|
||||
|
||||
USER ${USER}
|
||||
WORKDIR /root
|
||||
@@ -272,9 +275,13 @@ ENV PHP_VERSION="${PHP_VERSION}"
|
||||
ENV DISTRO_VERSION="${IMAGE_VERSION}"
|
||||
ENV WWW_ROOT_DIR="${WWW_ROOT_DIR}"
|
||||
ENV GOPATH="/usr/local/share/go"
|
||||
ENV GOBIN="/usr/local/bin"
|
||||
ENV GOCACHE="/usr/local/share/go/cache"
|
||||
ENV CGO_ENABLED="0"
|
||||
ENV GOTOOLCHAIN="auto"
|
||||
ENV GOFLAGS="-buildvcs=false"
|
||||
ENV GOTELEMETRY="off"
|
||||
ENV GOPROXY="https://proxy.golang.org,direct"
|
||||
|
||||
COPY --from=build /. /
|
||||
|
||||
|
||||
Reference in New Issue
Block a user