leodotcloud / swiss-army-knife

Apache License 2.0
79 stars 28 forks source link

Multi-Arch Support #18

Open tuxpeople opened 3 years ago

tuxpeople commented 3 years ago

Hi

Just stumbled upon this. For the very same reasons, I created my one "debugging" Image.

I'm thinking now to drop mine in favor of yours. Would you mind to make your image multiarch? Mainly arm64 would be interesting for me, as I'm doing a lot with ARM based Kubernetes.

Kind regards Thomas

leodotcloud commented 3 years ago

@tuxpeople Thanks for the suggestion (sorry just seeing your message). Would you be able to provide a PR?

tuxpeople commented 3 years ago

Looks like you are using Drone for your pipeline. tbh, I've not much experience with Drone. I used to do it with GitHub actions, and sometimes with Travis.

leodotcloud commented 3 years ago

@tuxpeople if you the build scripts, I can integrate them into Drone.

tuxpeople commented 3 years ago

@leodotcloud

Right now, I'm using GitHub Actions, that's how I'm doing it right now: https://github.com/tuxpeople/docker-debugcontainer/blob/master/.github/workflows/release.yml

My travel to this solution started here: https://nexus.eddiesinentropy.net/2020/01/12/Building-Multi-architecture-Docker-Images-With-Buildx/ this article explains a lot of the whole background how to to this using dockers buildx and qemu.

The essence of this article is this script: https://gist.github.com/ArturKlauser/76c29a059f2a73783e77a3ce98cd23c2

This script was more or less the one I used with TravisCI before I switched to GitHub Actions: https://github.com/tuxpeople/docker-debugcontainer/blob/41dbe0173c249893d74e26e37a90100cd672d34b/ci_old/.travis/build-deploy.sh

The script expects to be run in a clean Ubuntu VM and will install all the dependencies needed for Docker buildx you basically just need to call it's main function: https://gist.github.com/ArturKlauser/76c29a059f2a73783e77a3ce98cd23c2#file-multi-arch-docker-ci-sh-L15-L16

You need to provide some env-vars like

DOCKER_USERNAME DOCKER_PASSWORD DOCKER_BASE

Others like DOCKER_PLATFORMS are set by the script: https://gist.github.com/ArturKlauser/76c29a059f2a73783e77a3ce98cd23c2#file-multi-arch-docker-ci-sh-L121-L123

Not sure if you could implement this in drone.

xshadowlegendx commented 2 months ago

hello @leodotcloud, I have tried building the docker image replacing amd64 with $(dpkg --print-architecture) and so far able to installed everything inside the Dockerfile and run those commands, I was gonna try drone but they seems to be moving to harness so I haven't try that yet.

Im going to build the swift army knife binary next and test it with the image, so after this works all left is to include it into drone build is that all? if so I could maybe help with the pr

leodotcloud commented 2 months ago

@xshadowlegendx PR would be highly appreciated!

leodotcloud commented 2 months ago

Ideally would be good if we can migrate to GitHub Actions, been hard to get cycles for that.

xshadowlegendx commented 2 months ago

hello @leodotcloud, ok I will add the arm64 support and also add github workflow for this in a pr