Skip to content

Commit b95c82d

Browse files
authored
docker build: don't build ca-certs separately for each architecture (#2157)
This is a minor efficiency improvement in the docker build. We only use the certs build step as a source for ca-certificates. This is architecture independent, so we don't need to build a separate one for each architecture.
1 parent cf13249 commit b95c82d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ ARG DEBIAN_IMAGE=registry.k8s.io/build-image/debian-base:bullseye-v1.4.3
3737

3838
# Build an image containing a common ca-certificates used by all target images
3939
# regardless of how they are built. We arbitrarily take ca-certificates from
40-
# the Alpine image.
41-
FROM ${ALPINE_IMAGE} as certs
40+
# the amd64 Alpine image.
41+
FROM --platform=linux/amd64 ${ALPINE_IMAGE} as certs
4242
RUN apk add --no-cache ca-certificates
4343

4444

4545
# Build all command targets. We build all command targets in a single build
4646
# stage for efficiency. Target images copy their binary from this image.
47+
# We use go's native cross compilation for multi-arch in this stage, so the
48+
# builder itself is always amd64
4749
FROM --platform=linux/amd64 ${GOLANG_IMAGE} as builder
4850

4951
ARG GOPROXY=https://goproxy.io,direct

0 commit comments

Comments
 (0)