Skip to content

Commit

Permalink
fix cross-platform builds, multi-arch signing (#121)
Browse files Browse the repository at this point in the history
Signed-off-by: Brooks Newberry <[email protected]>
  • Loading branch information
brooksn authored Oct 16, 2024
1 parent 4d5cab2 commit e6c2e40
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG ARCH="amd64"
ARG ARCH=${TARGETARCH}
ARG BCI_IMAGE=registry.suse.com/bci/bci-base
ARG GO_IMAGE=rancher/hardened-build-base:v1.22.8b1
ARG CNI_IMAGE_VERSION=v1.5.1-build20241009
Expand Down
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ ifndef TARGET_PLATFORMS
endif
endif

IMAGE_DIGESTS ?=
IID_FILE_FLAG ?=
IID_FILE_PATH := $(if $(IID_FILE_FLAG),$(word 2, $(IID_FILE_FLAG)))

K3S_ROOT_VERSION ?= v0.14.0
BUILD_META=-build$(shell date +%Y%m%d)
MACHINE := rancher
Expand All @@ -40,7 +44,7 @@ $(error TAG $(TAG) needs to end with build metadata: $(BUILD_META))
endif

buildx-machine:
@docker buildx ls | grep $(MACHINE) || \
docker buildx inspect $(MACHINE) > /dev/null 2>&1 || \
docker buildx create --name=$(MACHINE) --platform=linux/arm64,linux/amd64

.PHONY: image-build
Expand Down Expand Up @@ -72,8 +76,11 @@ push-image: buildx-machine
.

.PHONY: manifest-push
manifest-push:
docker buildx imagetools create -t $(IMAGE) -t $(REGISTRY_IMAGE):latest $(IMAGE_DIGESTS)
manifest-push: buildx-machine
docker buildx imagetools create --builder=$(MACHINE) -t $(IMAGE) -t $(REGISTRY_IMAGE):latest $(IMAGE_DIGESTS)
ifneq ($(strip $(IID_FILE_PATH)),)
docker buildx imagetools inspect --format "{{json .Manifest}}" $(IMAGE) | jq -r '.digest' > "$(IID_FILE_PATH)"
endif

.PHONY: image-scan
image-scan:
Expand Down

0 comments on commit e6c2e40

Please sign in to comment.