Skip to content

Commit

Permalink
Merge pull request #49 from acumino/multi-arch
Browse files Browse the repository at this point in the history
Build mulit-arch image
  • Loading branch information
k8s-ci-robot authored Jun 17, 2022
2 parents eb45d01 + c3c9391 commit 9ed9867
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ IMAGE := $(REGISTRY)/$(BIN)-$(ARCH)

BUILD_IMAGE ?= golang:1.12.7-alpine

MULTIARCH_IMAGE := $(REGISTRY)/$(BIN)

# If you want to build all binaries, see the 'all-build' rule.
# If you want to build all containers, see the 'all-container' rule.
# If you want to build AND push all containers, see the 'all-push' rule.
Expand All @@ -62,7 +64,7 @@ all-build: $(addprefix build-, $(ALL_ARCH))

all-container: $(addprefix container-, $(ALL_ARCH))

all-push: $(addprefix push-, $(ALL_ARCH))
arch-push: $(addprefix push-, $(ALL_ARCH))

build: bin/$(ARCH)/$(BIN)

Expand Down Expand Up @@ -109,6 +111,15 @@ push: .push-$(DOTFILE_IMAGE) push-name
push-name:
@echo "pushed: $(IMAGE):$(VERSION)"

multiarch-container: arch-push
docker manifest create $(MULTIARCH_IMAGE):$(VERSION) $(addprefix --amend $(REGISTRY)/$(BIN)-, $(addsuffix :$(VERSION), $(ALL_ARCH)))
for arch in $(ALL_ARCH); do \
docker manifest annotate --arch $${arch} $(MULTIARCH_IMAGE):$(VERSION) $(REGISTRY)/$(BIN)-$${arch}:$(VERSION) ; \
done

all-push: multiarch-container
@gcloud docker -- manifest push $(MULTIARCH_IMAGE):$(VERSION)

version:
@echo $(VERSION)

Expand Down

0 comments on commit 9ed9867

Please sign in to comment.