diff --git a/dependencies.yaml b/dependencies.yaml index 1fceae8925a..c3d80fdac90 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -144,7 +144,7 @@ dependencies: - path: images/build/go-runner/VERSION - name: "registry.k8s.io/build-image/go-runner (go1.25-bookworm)" - version: v2.4.0-go1.25rc2-bookworm.0 + version: v2.4.0-go1.25.1-bookworm.0 refPaths: - path: images/build/go-runner/variants.yaml match: v((([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?) @@ -195,7 +195,7 @@ dependencies: match: "CONFIG: 'go\\d+.\\d+-bullseye'" - name: "registry.k8s.io/build-image/kube-cross (v1.34-go1.25)" - version: v1.34.0-go1.25rc2-bullseye.0 + version: v1.34.0-go1.25.1-bullseye.0 refPaths: - path: images/build/cross/variants.yaml match: "IMAGE_VERSION: 'v((([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?)(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?)'" diff --git a/images/build/cross/Makefile b/images/build/cross/Makefile index 5d8627da951..b8f88678bca 100644 --- a/images/build/cross/Makefile +++ b/images/build/cross/Makefile @@ -35,7 +35,7 @@ REVISION ?= 0 TYPE ?= default # Build args -BASEIMAGE ?= golang:$(GO_VERSION)-$(OS_CODENAME) +BASEIMAGE ?= debian:$(OS_CODENAME)-slim PROTOBUF_VERSION ?= 3.19.4 IMAGE = $(REGISTRY)/$(IMGNAME) @@ -83,6 +83,8 @@ container: check-env init-docker-buildx --tag $(IMAGE)-$${platform##*/}:latest-$(CONFIG)-$(TYPE) \ --build-arg=BASEIMAGE=$(BASEIMAGE) \ --build-arg=PROTOBUF_VERSION=$(PROTOBUF_VERSION) \ + --build-arg=TARGETPLATFORM=$${platform} \ + --build-arg=GO_VERSION=$(GO_VERSION) \ --file $(TYPE)/Dockerfile \ .; \ done diff --git a/images/build/cross/default/Dockerfile b/images/build/cross/default/Dockerfile index f73de9c8b7d..590e998061a 100644 --- a/images/build/cross/default/Dockerfile +++ b/images/build/cross/default/Dockerfile @@ -16,6 +16,8 @@ # platform go binary for the architecture kubernetes cares about. ARG BASEIMAGE +ARG GO_VERSION +FROM golang:${GO_VERSION}-alpine as go-source FROM ${BASEIMAGE} ##------------------------------------------------------------ @@ -40,6 +42,12 @@ ENV KUBE_CROSSPLATFORMS \ windows/amd64 windows/386 ##------------------------------------------------------------ +COPY --from=go-source /usr/local/go /usr/local/go +ENV PATH=/usr/local/go/bin:$PATH +ENV GOROOT=/usr/local/go +ENV GOLANG_VERSION=${GO_VERSION} +ENV GOTOOLCHAIN=local +ENV GOPATH=/usr/local/go # Pre-compile the standard go library when cross-compiling. This is much easier now when we have go1.5+ RUN targetArch=$(echo $TARGETPLATFORM | cut -f2 -d '/') \ @@ -52,12 +60,17 @@ fi RUN apt-get -q update \ && apt-get install -qqy \ apt-utils \ + curl \ file \ + git \ + gnupg2 \ + iproute2 \ jq \ + openssh-client \ patch \ rsync \ unzip \ - iproute2 + wget # Use dynamic cgo linking for architectures other than amd64 for the server platforms # To install crossbuild essential for other architectures add the following repository. diff --git a/images/build/cross/variants.yaml b/images/build/cross/variants.yaml index 3c0a765706e..7a61b24b83b 100644 --- a/images/build/cross/variants.yaml +++ b/images/build/cross/variants.yaml @@ -2,9 +2,9 @@ variants: v1.34-go1.25-bullseye: CONFIG: 'go1.25-bullseye' TYPE: 'default' - IMAGE_VERSION: 'v1.34.0-go1.25rc2-bullseye.0' + IMAGE_VERSION: 'v1.34.0-go1.25.1-bullseye.0' KUBERNETES_VERSION: 'v1.34.0' - GO_VERSION: '1.25rc2' + GO_VERSION: '1.25.1' GO_MAJOR_VERSION: '1.25' OS_CODENAME: 'bullseye' REVISION: '0' diff --git a/images/build/go-runner/Dockerfile b/images/build/go-runner/Dockerfile index 0ac4c3ed83d..fe4c49112b0 100644 --- a/images/build/go-runner/Dockerfile +++ b/images/build/go-runner/Dockerfile @@ -12,12 +12,27 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Build the manager binary +ARG GO_VERSION ARG DISTROLESS_IMAGE ARG BUILDER_IMAGE + +# Get Go from official Alpine image +FROM golang:${GO_VERSION}-alpine as go-source + +# Build the manager binary FROM ${BUILDER_IMAGE} as builder WORKDIR /workspace +# Copy Go installation from official image +COPY --from=go-source /usr/local/go /usr/local/go + +# Set up Go environment +ENV PATH=/usr/local/go/bin:$PATH +ENV GOROOT=/usr/local/go +ENV GOLANG_VERSION=${GO_VERSION} +ENV GOTOOLCHAIN=local +ENV GOPATH=/usr/local/go + # Copy the sources COPY ./go-runner.go ./ COPY ./go.* ./ @@ -38,11 +53,8 @@ ENV GOPROXY="https://proxy.golang.org|direct" # Build ARG package=. -ARG ARCH ENV CGO_ENABLED=0 -ENV GOOS=linux -ENV GOARCH=${ARCH} RUN go env diff --git a/images/build/go-runner/Makefile b/images/build/go-runner/Makefile index 69987a44bd2..33cb8b7ece6 100644 --- a/images/build/go-runner/Makefile +++ b/images/build/go-runner/Makefile @@ -20,12 +20,12 @@ APP_VERSION = $(shell cat VERSION) GO_MAJOR_VERSION ?= 1.24 REVISION ?= 0 GO_VERSION ?= 1.24.6 -OS_CODENAME ?= bookworm +OS_CODENAME ?= bookworm-slim # Build args DISTROLESS_REGISTRY ?= gcr.io/distroless DISTROLESS_IMAGE ?= static-debian12 -BUILDER_IMAGE ?= golang:$(GO_VERSION)-$(OS_CODENAME) +BUILDER_IMAGE ?= debian:$(OS_CODENAME) # Configuration CONFIG = go$(GO_MAJOR_VERSION)-$(OS_CODENAME) @@ -53,4 +53,5 @@ clean: rm go-runner BUILD_ARGS = --build-arg=BUILDER_IMAGE=$(BUILDER_IMAGE) \ - --build-arg=DISTROLESS_IMAGE=$(DISTROLESS_REGISTRY)/$(DISTROLESS_IMAGE) + --build-arg=DISTROLESS_IMAGE=$(DISTROLESS_REGISTRY)/$(DISTROLESS_IMAGE) \ + --build-arg=GO_VERSION=$(GO_VERSION) diff --git a/images/build/go-runner/variants.yaml b/images/build/go-runner/variants.yaml index 81f4542da83..882934f42d7 100644 --- a/images/build/go-runner/variants.yaml +++ b/images/build/go-runner/variants.yaml @@ -1,11 +1,11 @@ variants: go1.25-bookworm: CONFIG: 'go1.25-bookworm' - IMAGE_VERSION: 'v2.4.0-go1.25rc2-bookworm.0' + IMAGE_VERSION: 'v2.4.0-go1.25.1-bookworm.0' GO_MAJOR_VERSION: '1.25' OS_CODENAME: 'bookworm' REVISION: '0' - GO_VERSION: '1.25rc2' + GO_VERSION: '1.25.1' DISTROLESS_IMAGE: 'static-debian12' go1.24-bookworm: CONFIG: 'go1.24-bookworm' diff --git a/images/releng/ci/Dockerfile b/images/releng/ci/Dockerfile index b41b91a9fa0..7b390dc7146 100644 --- a/images/releng/ci/Dockerfile +++ b/images/releng/ci/Dockerfile @@ -14,7 +14,25 @@ ARG GO_VERSION ARG OS_CODENAME -FROM golang:${GO_VERSION}-${OS_CODENAME} as builder + +# Get Go from official Alpine image +FROM golang:${GO_VERSION}-alpine as go-source + +FROM debian:${OS_CODENAME}-slim + +# Copy Go installation from official image +COPY --from=go-source /usr/local/go /usr/local/go + +# Set up Go environment +ENV PATH=/usr/local/go/bin:$PATH +ENV GOROOT=/usr/local/go +ENV GOLANG_VERSION=${GO_VERSION} +ENV GOTOOLCHAIN=local +ENV GOPATH=/usr/local/go + +# Install required packages for adding Google Cloud SDK repository +RUN apt-get update && \ + apt-get install -y curl gnupg RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | \ tee -a /etc/apt/sources.list.d/google-cloud-sdk.list @@ -26,9 +44,11 @@ RUN apt-get update && \ apt-get install -y \ bsdmainutils \ build-essential \ + git \ google-cloud-sdk \ jq \ rpmlint \ + wget \ && rm -rf /var/lib/apt/lists/* # install goreleaser diff --git a/images/releng/ci/variants.yaml b/images/releng/ci/variants.yaml index 642e9f36482..907ede44acf 100644 --- a/images/releng/ci/variants.yaml +++ b/images/releng/ci/variants.yaml @@ -1,7 +1,7 @@ variants: go1.25-bookworm: CONFIG: 'go1.25-bookworm' - GO_VERSION: '1.25rc2' + GO_VERSION: '1.25.1' OS_CODENAME: 'bookworm' REVISION: '0' go1.24-bookworm: diff --git a/images/releng/k8s-ci-builder/Dockerfile b/images/releng/k8s-ci-builder/Dockerfile index c9fb8d001c9..81a61c9c8fb 100644 --- a/images/releng/k8s-ci-builder/Dockerfile +++ b/images/releng/k8s-ci-builder/Dockerfile @@ -17,7 +17,21 @@ ARG OS_CODENAME # The Release Tooling can be compiled with a different version of Go than the # the Go version used in the kubernetes/kubernetes active development branch. -FROM golang:${GO_VERSION_TOOLING}-${OS_CODENAME} AS builder +FROM golang:${GO_VERSION_TOOLING}-alpine as go-source +FROM debian:${OS_CODENAME}-slim AS builder + +# Install CA certificates for TLS verification +RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* + +# Copy Go installation from official image +COPY --from=go-source /usr/local/go /go + +# Set up Go environment +ENV PATH=/go/bin:$PATH +ENV GOROOT=/go +ENV GOLANG_VERSION=${GO_VERSION_TOOLING} +ENV GOTOOLCHAIN=local +ENV GOPATH=/go WORKDIR /go/src/k8s.io/release diff --git a/images/releng/k8s-ci-builder/variants.yaml b/images/releng/k8s-ci-builder/variants.yaml index b6d5fdc603e..8b463c79d8d 100644 --- a/images/releng/k8s-ci-builder/variants.yaml +++ b/images/releng/k8s-ci-builder/variants.yaml @@ -6,8 +6,8 @@ variants: OS_CODENAME: 'bullseye' next: CONFIG: next - GO_VERSION: '1.25rc2' - GO_VERSION_TOOLING: '1.24.6' + GO_VERSION: '1.25.1' + GO_VERSION_TOOLING: '1.25.1' OS_CODENAME: 'bookworm' '1.34': CONFIG: '1.34'