From 1ebaef3663934028df5aa2ca3bab950ccad096ff Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 26 Sep 2023 12:43:38 +0200 Subject: [PATCH] Dockerfile: use GOTOOLCHAIN=local This may find its way into the official images, but until it does, let's make sure we don't get unexpected updates of go. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit e9759cee6911fd5b7f799fe26876bcfbbd4969a8) Signed-off-by: Sebastiaan van Stijn --- Dockerfile | 2 ++ dockerfiles/Dockerfile.dev | 3 ++- dockerfiles/Dockerfile.lint | 1 + dockerfiles/Dockerfile.vendor | 1 + e2e/testdata/Dockerfile.gencerts | 1 + 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 999c0f36d5..090608cf15 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,7 @@ ARG COMPOSE_VERSION=v2.22.0 FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS build-base-alpine +ENV GOTOOLCHAIN=local COPY --link --from=xx / / RUN apk add --no-cache bash clang lld llvm file git WORKDIR /go/src/github.com/docker/cli @@ -22,6 +23,7 @@ ARG TARGETPLATFORM RUN xx-apk add --no-cache musl-dev gcc FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-bullseye AS build-base-bullseye +ENV GOTOOLCHAIN=local COPY --link --from=xx / / RUN apt-get update && apt-get install --no-install-recommends -y bash clang lld llvm file WORKDIR /go/src/github.com/docker/cli diff --git a/dockerfiles/Dockerfile.dev b/dockerfiles/Dockerfile.dev index 821cca82e1..58afd25cfa 100644 --- a/dockerfiles/Dockerfile.dev +++ b/dockerfiles/Dockerfile.dev @@ -7,7 +7,8 @@ ARG BUILDX_VERSION=0.11.2 FROM docker/buildx-bin:${BUILDX_VERSION} AS buildx FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS golang -ENV CGO_ENABLED=0 +ENV GOTOOLCHAIN=local +ENV CGO_ENABLED=0 FROM golang AS gofumpt ARG GOFUMPT_VERSION=v0.4.0 diff --git a/dockerfiles/Dockerfile.lint b/dockerfiles/Dockerfile.lint index a869833d52..130f93cdce 100644 --- a/dockerfiles/Dockerfile.lint +++ b/dockerfiles/Dockerfile.lint @@ -7,6 +7,7 @@ ARG GOLANGCI_LINT_VERSION=v1.54.2 FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS lint +ENV GOTOOLCHAIN=local ENV GO111MODULE=off ENV CGO_ENABLED=0 ENV GOGC=75 diff --git a/dockerfiles/Dockerfile.vendor b/dockerfiles/Dockerfile.vendor index 9f960c5e0b..4b70feba60 100644 --- a/dockerfiles/Dockerfile.vendor +++ b/dockerfiles/Dockerfile.vendor @@ -5,6 +5,7 @@ ARG ALPINE_VERSION=3.17 ARG MODOUTDATED_VERSION=v0.8.0 FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS base +ENV GOTOOLCHAIN=local RUN apk add --no-cache bash git rsync WORKDIR /src diff --git a/e2e/testdata/Dockerfile.gencerts b/e2e/testdata/Dockerfile.gencerts index 5d5a13fe11..1115305f11 100644 --- a/e2e/testdata/Dockerfile.gencerts +++ b/e2e/testdata/Dockerfile.gencerts @@ -3,6 +3,7 @@ ARG GO_VERSION=1.20.8 FROM golang:${GO_VERSION}-alpine AS generated +ENV GOTOOLCHAIN=local RUN go install github.com/dmcgowan/quicktls@master WORKDIR /tmp/gencerts/notary RUN --mount=type=bind,source=e2e/testdata/notary,target=/tmp/gencerts/notary,rw <