Skip to content

Commit 9a03451

Browse files
authored
Support arm64 builds (#2350)
* Support arm64 builds * Add some redundant TARGETARCH, just in case
1 parent 2dc8b8a commit 9a03451

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ ARG BASE_IMAGE=gcr.io/distroless/static:nonroot
55

66
## Multistage build
77
FROM ${BUILDER_IMAGE} AS builder
8+
ARG TARGETARCH
89
ENV CGO_ENABLED=0
910
ENV GOOS=linux
10-
ENV GOARCH=amd64
11+
ENV GOARCH=${TARGETARCH}
1112
ARG COMMIT_SHA=unknown
1213
ARG BUILD_REF
1314

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ image-build: ## Build the EPP image using Docker Buildx.
242242
--platform=$(PLATFORMS) \
243243
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
244244
--build-arg BUILDER_IMAGE=$(BUILDER_IMAGE) \
245+
--build-arg TARGETARCH=$(TARGETARCH) \
245246
--build-arg COMMIT_SHA=${GIT_COMMIT_SHA} \
246247
--build-arg BUILD_REF=${BUILD_REF} \
247248
$(PUSH) \
@@ -309,6 +310,7 @@ bbr-image-build: ## Build the image using Docker Buildx.
309310
--platform=$(PLATFORMS) \
310311
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
311312
--build-arg BUILDER_IMAGE=$(BUILDER_IMAGE) \
313+
--build-arg TARGETARCH=$(TARGETARCH) \
312314
$(PUSH) \
313315
$(LOAD) \
314316
$(BBR_IMAGE_BUILD_EXTRA_OPTS) ./

bbr.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ ARG BASE_IMAGE=gcr.io/distroless/static:nonroot
55

66
## Multistage build
77
FROM ${BUILDER_IMAGE} AS builder
8+
ARG TARGETARCH
89
ENV CGO_ENABLED=0
910
ENV GOOS=linux
10-
ENV GOARCH=amd64
11+
ENV GOARCH=${TARGETARCH}
1112
ARG COMMIT_SHA=unknown
1213
ARG BUILD_REF
1314

cloudbuild.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ steps:
1313
- EXTRA_TAG=$_PULL_BASE_REF
1414
- DOCKER_BUILDX_CMD=/buildx-entrypoint
1515
- GIT_COMMIT_SHA=$_PULL_BASE_SHA
16+
- PLATFORMS=linux/amd64,linux/arm64
1617
- name: gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20240718-5ef92b5c36
1718
entrypoint: make
1819
args:
@@ -21,6 +22,7 @@ steps:
2122
- GIT_TAG=$_GIT_TAG
2223
- EXTRA_TAG=$_PULL_BASE_REF
2324
- DOCKER_BUILDX_CMD=/buildx-entrypoint
25+
- PLATFORMS=linux/amd64,linux/arm64
2426
- name: gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20240718-5ef92b5c36
2527
entrypoint: make
2628
args:
@@ -38,6 +40,7 @@ steps:
3840
- GIT_TAG=$_GIT_TAG
3941
- EXTRA_TAG=$_PULL_BASE_REF
4042
- DOCKER_BUILDX_CMD=/buildx-entrypoint
43+
- PLATFORMS=linux/amd64,linux/arm64
4144
- name: gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20240718-5ef92b5c36
4245
entrypoint: make
4346
args:
@@ -48,6 +51,7 @@ steps:
4851
- GIT_TAG=$_GIT_TAG
4952
- EXTRA_TAG=$_PULL_BASE_REF
5053
- DOCKER_BUILDX_CMD=/buildx-entrypoint
54+
- PLATFORMS=linux/amd64,linux/arm64
5155
substitutions:
5256
# _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and
5357
# can be used as a substitution

0 commit comments

Comments
 (0)