From b643595f97209e0e67f0cf62e13d4fb6c609451b Mon Sep 17 00:00:00 2001 From: Joseph Ferguson Date: Fri, 15 Sep 2023 16:57:07 -0700 Subject: [PATCH] Set `GOTOOLCHAIN` to prevent go auto-upgrade --- 1.21/alpine3.17/Dockerfile | 4 ++++ 1.21/alpine3.18/Dockerfile | 4 ++++ 1.21/bookworm/Dockerfile | 4 ++++ 1.21/bullseye/Dockerfile | 4 ++++ Dockerfile-linux.template | 6 ++++++ 5 files changed, 22 insertions(+) diff --git a/1.21/alpine3.17/Dockerfile b/1.21/alpine3.17/Dockerfile index 2db04201..1af06fb3 100644 --- a/1.21/alpine3.17/Dockerfile +++ b/1.21/alpine3.17/Dockerfile @@ -118,6 +118,10 @@ RUN set -eux; \ \ go version +# don't auto-upgrade the gotoolchain +# https://github.com/docker-library/golang/issues/472 +ENV GOTOOLCHAIN=local + ENV GOPATH /go ENV PATH $GOPATH/bin:$PATH RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 1777 "$GOPATH" diff --git a/1.21/alpine3.18/Dockerfile b/1.21/alpine3.18/Dockerfile index 37eaad79..3a4479ca 100644 --- a/1.21/alpine3.18/Dockerfile +++ b/1.21/alpine3.18/Dockerfile @@ -118,6 +118,10 @@ RUN set -eux; \ \ go version +# don't auto-upgrade the gotoolchain +# https://github.com/docker-library/golang/issues/472 +ENV GOTOOLCHAIN=local + ENV GOPATH /go ENV PATH $GOPATH/bin:$PATH RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 1777 "$GOPATH" diff --git a/1.21/bookworm/Dockerfile b/1.21/bookworm/Dockerfile index 1cb6b057..2603d3fb 100644 --- a/1.21/bookworm/Dockerfile +++ b/1.21/bookworm/Dockerfile @@ -124,6 +124,10 @@ RUN set -eux; \ \ go version +# don't auto-upgrade the gotoolchain +# https://github.com/docker-library/golang/issues/472 +ENV GOTOOLCHAIN=local + ENV GOPATH /go ENV PATH $GOPATH/bin:$PATH RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 1777 "$GOPATH" diff --git a/1.21/bullseye/Dockerfile b/1.21/bullseye/Dockerfile index fb43eb8d..cc549c6e 100644 --- a/1.21/bullseye/Dockerfile +++ b/1.21/bullseye/Dockerfile @@ -130,6 +130,10 @@ RUN set -eux; \ \ go version +# don't auto-upgrade the gotoolchain +# https://github.com/docker-library/golang/issues/472 +ENV GOTOOLCHAIN=local + ENV GOPATH /go ENV PATH $GOPATH/bin:$PATH RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 1777 "$GOPATH" diff --git a/Dockerfile-linux.template b/Dockerfile-linux.template index 3687bef6..1f207db5 100644 --- a/Dockerfile-linux.template +++ b/Dockerfile-linux.template @@ -201,6 +201,12 @@ RUN set -eux; \ {{ ) else "" end -}} go version +{{ if [ "1.20" ] | index(env.version | rtrimstr("-rc")) then "" else ( -}} +# don't auto-upgrade the gotoolchain +# https://github.com/docker-library/golang/issues/472 +ENV GOTOOLCHAIN=local + +{{ ) end -}} ENV GOPATH /go ENV PATH $GOPATH/bin:$PATH RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 1777 "$GOPATH"