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

makefile: build multi-arch image #301

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,28 @@ image-build-buildah: build
$(BUILDAH_CMD) config --entrypoint='["/manager"]' $$cn && \
$(BUILDAH_CMD) commit $$cn $(IMG)


.PHONY: image-build-multiarch image-push-multiarch
image-build-multiarch: image-build-multiarch-manifest \
image-build-arch-amd64 image-build-arch-arm64
$(BUILDAH_CMD) manifest inspect $(IMG)

image-build-multiarch-manifest:
$(BUILDAH_CMD) manifest create $(IMG)

image-build-arch-%: qemu-utils
$(BUILDAH_CMD) bud \
--manifest $(IMG) \
--arch "$*" \
--tag "$(IMG)-$*" \
--build-arg=GIT_VERSION="$(GIT_VERSION)" \
--build-arg=COMMIT_ID="$(COMMIT_ID)" \
--build-arg=ARCH="$*" .

image-push-multiarch:
$(BUILDAH_CMD) manifest push --all $(IMG) "docker://$(IMG)"


# Push the container image
docker-push: container-push
container-push:
Expand Down Expand Up @@ -322,3 +344,12 @@ GITLINT=$(GOBIN_ALT)/gitlint
else
GITLINT=$(shell command -v gitlint ;)
endif

.PHONY: qemu-utils
qemu-utils:
ifeq (, $(shell command -v qemu-x86_64-static ;))
$(error "qemu-x86_64-static not found in PATH")
endif
ifeq (, $(shell command -v qemu-aarch64-static ;))
$(error "qemu-aarch64-static not found in PATH")
endif