Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build mulit-arch image #49

Merged
merged 1 commit into from
Jun 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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