File tree Expand file tree Collapse file tree 11 files changed +66
-21
lines changed Expand file tree Collapse file tree 11 files changed +66
-21
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ dependencies:
144144 - path : images/build/go-runner/VERSION
145145
146146 - name : " registry.k8s.io/build-image/go-runner (go1.25-bookworm)"
147- version : v2.4.0-go1.25.0 -bookworm.0
147+ version : v2.4.0-go1.25.1 -bookworm.0
148148 refPaths :
149149 - path : images/build/go-runner/variants.yaml
150150 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:
195195 match : " CONFIG: 'go\\ d+.\\ d+-bullseye'"
196196
197197 - name : " registry.k8s.io/build-image/kube-cross (v1.34-go1.25)"
198- version : v1.34.0-go1.25.0 -bullseye.0
198+ version : v1.34.0-go1.25.1 -bullseye.0
199199 refPaths :
200200 - path : images/build/cross/variants.yaml
201201 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-]+)*))?)'"
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ REVISION ?= 0
3535TYPE ?= default
3636
3737# Build args
38- BASEIMAGE ?= golang :$(GO_VERSION ) - $( OS_CODENAME )
38+ BASEIMAGE ?= debian :$(OS_CODENAME ) -slim
3939PROTOBUF_VERSION ?= 3.19.4
4040
4141IMAGE = $(REGISTRY ) /$(IMGNAME )
@@ -83,6 +83,8 @@ container: check-env init-docker-buildx
8383 --tag $(IMAGE ) -$$ {platform## */}:latest-$(CONFIG)-$(TYPE) \
8484 --build-arg=BASEIMAGE=$(BASEIMAGE ) \
8585 --build-arg=PROTOBUF_VERSION=$(PROTOBUF_VERSION ) \
86+ --build-arg=TARGETPLATFORM=$$ {platform} \
87+ --build-arg=GO_VERSION=$(GO_VERSION ) \
8688 --file $(TYPE ) /Dockerfile \
8789 . ; \
8890 done
Original file line number Diff line number Diff line change 1616# platform go binary for the architecture kubernetes cares about.
1717
1818ARG BASEIMAGE
19+ ARG GO_VERSION
20+ FROM golang:${GO_VERSION}-alpine as go-source
1921FROM ${BASEIMAGE}
2022
2123# #------------------------------------------------------------
@@ -40,7 +42,9 @@ ENV KUBE_CROSSPLATFORMS \
4042 windows/amd64 windows/386
4143
4244# #------------------------------------------------------------
43-
45+ COPY --from=go-source /usr/local/go /usr/local/go
46+ ENV PATH=/usr/local/go/bin:$PATH
47+ ENV GOROOT=/usr/local/go
4448# Pre-compile the standard go library when cross-compiling. This is much easier now when we have go1.5+
4549RUN targetArch=$(echo $TARGETPLATFORM | cut -f2 -d '/' ) \
4650 && if [ ${targetArch} = "amd64" ]; then \
@@ -53,11 +57,13 @@ RUN apt-get -q update \
5357 && apt-get install -qqy \
5458 apt-utils \
5559 file \
60+ gnupg2 \
61+ iproute2 \
5662 jq \
5763 patch \
5864 rsync \
5965 unzip \
60- iproute2
66+ wget
6167
6268# Use dynamic cgo linking for architectures other than amd64 for the server platforms
6369# To install crossbuild essential for other architectures add the following repository.
Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ variants:
22 v1.34-go1.25-bullseye :
33 CONFIG : ' go1.25-bullseye'
44 TYPE : ' default'
5- IMAGE_VERSION : ' v1.34.0-go1.25.0 -bullseye.0'
5+ IMAGE_VERSION : ' v1.34.0-go1.25.1 -bullseye.0'
66 KUBERNETES_VERSION : ' v1.34.0'
7- GO_VERSION : ' 1.25.0 '
7+ GO_VERSION : ' 1.25.1 '
88 GO_MAJOR_VERSION : ' 1.25'
99 OS_CODENAME : ' bullseye'
1010 REVISION : ' 0'
Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- # Build the manager binary
15+ ARG GO_VERSION
1616ARG DISTROLESS_IMAGE
1717ARG BUILDER_IMAGE
18+
19+ # Get Go from official Alpine image
20+ FROM golang:${GO_VERSION}-alpine as go-source
21+
22+ # Build the manager binary
1823FROM ${BUILDER_IMAGE} as builder
1924WORKDIR /workspace
2025
26+ # Copy Go installation from official image
27+ COPY --from=go-source /usr/local/go /usr/local/go
28+
29+ # Set up Go environment
30+ ENV PATH=/usr/local/go/bin:$PATH
31+ ENV GOROOT=/usr/local/go
32+
2133# Copy the sources
2234COPY ./go-runner.go ./
2335COPY ./go.* ./
@@ -38,11 +50,8 @@ ENV GOPROXY="https://proxy.golang.org|direct"
3850
3951# Build
4052ARG package=.
41- ARG ARCH
4253
4354ENV CGO_ENABLED=0
44- ENV GOOS=linux
45- ENV GOARCH=${ARCH}
4655
4756RUN go env
4857
Original file line number Diff line number Diff line change @@ -20,12 +20,12 @@ APP_VERSION = $(shell cat VERSION)
2020GO_MAJOR_VERSION ?= 1.24
2121REVISION ?= 0
2222GO_VERSION ?= 1.24.6
23- OS_CODENAME ?= bookworm
23+ OS_CODENAME ?= bookworm-slim
2424
2525# Build args
2626DISTROLESS_REGISTRY ?= gcr.io/distroless
2727DISTROLESS_IMAGE ?= static-debian12
28- BUILDER_IMAGE ?= golang: $( GO_VERSION ) - $(OS_CODENAME )
28+ BUILDER_IMAGE ?= debian: $(OS_CODENAME )
2929
3030# Configuration
3131CONFIG = go$(GO_MAJOR_VERSION ) -$(OS_CODENAME )
5353 rm go-runner
5454
5555BUILD_ARGS = --build-arg=BUILDER_IMAGE=$(BUILDER_IMAGE ) \
56- --build-arg=DISTROLESS_IMAGE=$(DISTROLESS_REGISTRY ) /$(DISTROLESS_IMAGE )
56+ --build-arg=DISTROLESS_IMAGE=$(DISTROLESS_REGISTRY ) /$(DISTROLESS_IMAGE ) \
57+ --build-arg=GO_VERSION=$(GO_VERSION )
Original file line number Diff line number Diff line change 11variants :
22 go1.25-bookworm :
33 CONFIG : ' go1.25-bookworm'
4- IMAGE_VERSION : ' v2.4.0-go1.25.0 -bookworm.0'
4+ IMAGE_VERSION : ' v2.4.0-go1.25.1 -bookworm.0'
55 GO_MAJOR_VERSION : ' 1.25'
66 OS_CODENAME : ' bookworm'
77 REVISION : ' 0'
8- GO_VERSION : ' 1.25.0 '
8+ GO_VERSION : ' 1.25.1 '
99 DISTROLESS_IMAGE : ' static-debian12'
1010 go1.24-bookworm :
1111 CONFIG : ' go1.24-bookworm'
Original file line number Diff line number Diff line change 1414
1515ARG GO_VERSION
1616ARG OS_CODENAME
17- FROM golang:${GO_VERSION}-${OS_CODENAME} as builder
17+
18+ # Get Go from official Alpine image
19+ FROM golang:${GO_VERSION}-alpine as go-source
20+
21+ FROM debian:${OS_CODENAME}-slim
22+
23+ # Copy Go installation from official image
24+ COPY --from=go-source /usr/local/go /usr/local/go
25+
26+ # Set up Go environment
27+ ENV PATH=/usr/local/go/bin:$PATH
28+ ENV GOROOT=/usr/local/go
29+
30+ # Install required packages for adding Google Cloud SDK repository
31+ RUN apt-get update && \
32+ apt-get install -y curl gnupg
1833
1934RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | \
2035 tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
@@ -29,6 +44,7 @@ RUN apt-get update && \
2944 google-cloud-sdk \
3045 jq \
3146 rpmlint \
47+ wget \
3248 && rm -rf /var/lib/apt/lists/*
3349
3450# install goreleaser
Original file line number Diff line number Diff line change 11variants :
22 go1.25-bookworm :
33 CONFIG : ' go1.25-bookworm'
4- GO_VERSION : ' 1.25.0 '
4+ GO_VERSION : ' 1.25.1 '
55 OS_CODENAME : ' bookworm'
66 REVISION : ' 0'
77 go1.24-bookworm :
Original file line number Diff line number Diff line change @@ -17,7 +17,18 @@ ARG OS_CODENAME
1717
1818# The Release Tooling can be compiled with a different version of Go than the
1919# the Go version used in the kubernetes/kubernetes active development branch.
20- FROM golang:${GO_VERSION_TOOLING}-${OS_CODENAME} AS builder
20+ FROM golang:${GO_VERSION_TOOLING}-alpine as go-source
21+ FROM debian:${OS_CODENAME}-slim AS builder
22+
23+ # Install CA certificates for TLS verification
24+ RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
25+
26+ # Copy Go installation from official image
27+ COPY --from=go-source /usr/local/go /go
28+
29+ # Set up Go environment
30+ ENV PATH=/go/bin:$PATH
31+ ENV GOROOT=/go
2132
2233WORKDIR /go/src/k8s.io/release
2334
You can’t perform that action at this time.
0 commit comments