-
Notifications
You must be signed in to change notification settings - Fork 24
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
base: master
Are you sure you want to change the base?
makefile: build multi-arch image #301
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good so far, I am a bit curious why it uses buidah directly rather than docker/podman. Were there features of the process that are only supported by buildah?
Also, could we leverage make's typical target based workflows rather than an embedded shell loop? Something like: .PHONY: image-build-multiarch
image-build-multiarch: image-build-arch-amd64 image-build-arch-arm64
$(BUILDAH_CMD) manifest inspect $(IMG)
image-build-arch-%: qemu-utils image-build-multiarch-manifest
$(BUILDAH_CMD) bud \
--manifest $(IMG) \
--arch $* \
--tag "$(IMG)-$*" \
--build-arg=GIT_VERSION="$(GIT_VERSION)" \
--build-arg=COMMIT_ID="$(COMMIT_ID)" \
--build-arg=ARCH="$*" .
image-build-multiarch-manifest:
$(BUILDAH_CMD) manifest create $(IMG)
.PHONY: image-push-multiarch
image-push-multiarch:
$(BUILDAH_CMD) manifest push --all $(IMG) "docker://$(IMG)"
.PHONY: image-multiarch
image-multiarch: image-build-multiarch image-push-multiarch (I left out .PHONYs on my added rule names just to be a tad shorter in a gh comment) |
docker uses the |
Fair enough. Will fix. |
Build multi-architecture image using buildah and qemu static utilities. Creates an image with manifest which refs amd64 (x86_64) and arm64 (aarch64) architecture-specific sub-images. Using the same Dockerfile regardless of the actual CPU architecture, and let buildah+qemu do all the low-level logic. Note: typically, qemu would emulate arm64 on x86_64 which yields longer build time. Signed-off-by: Shachar Sharon <ssharon@redhat.com>
63b337f
to
052da28
Compare
Removed |
I run an ARM-based Kubernetes cluster and would like to integrate the samba-operator. Is there a timeline for when this PR will be merged? |
Hi @abachmann I was thinking about this topic recently after watching some devconf.us talks on youtube that were related to this subject. The issue isn't so much the samba-operator itself, as this codebase is golang and Go's got a pretty good cross compliation story. The real work needs to be done in the samba-container project we either need time or volunteers to help get us set up with multi-arch builds and manifest support for the latest tag and future release tags. Folks who are not samba experts but know something about docker and/or podman and containers and (probably) github actions could help a lot here. I'm sure eventually one of us current maintainers at samba-containers will get around to it - especially if it becomes relevant to our downstream - but I would not be able to provide a timeline for that. |
Build multi-architecture image using buildah and qemu static utilities. Creates an image with manifest which refs amd64 (x86_64) and arm64 (aarch64) architecture-specific sub-images. Using the same Dockerfile regardless of the actual CPU architecture, and let buildah+qemu do all the low-level logic.
Note: typically, qemu would emulate arm64 on x86_64 which yields longer build time.