Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to automate Multi-Arch-Docker Image builds

I have dockerized a nodejs app on github. My Dockerfile is based on the offical nodejs images. The offical node-repo supports multiple architectures (x86, amd64, arm) seamlessly. This means I can build the exact same Dockerfile on different machines resulting in different images for the respective architecture.

So I am trying to offer the same architectures seamlessly for my app, too. But how? My goal is automate it as much as possible. I know I need in theory to create a docker-manifest, which acts as a docker-repo and redirects the end-users-docker-clients to their suitable images.

Docker-Hub itself can monitor a github repo and kick off an automated build. Thats would take care of the amd64 image. But what about the remaining architectures? There is also the service called 'TravisCI' which I guess could take care of the arm-build with the help of qemu. Then I think both repos could then be referenced statically by the manifest-repo. But this still leaves a couple architectures unfulfilled.

But using multiple services/ways of building the same app feels wrong. Does anyone know a better and more complete solution to this problem? It's basically running the same dockerfile through a couple machines and recording them in a manifest.

like image 617
keydon Avatar asked Nov 07 '22 12:11

keydon


1 Answers

Starting with Docker 18.02 CLI you can create multi-arch manifests and push them to the docker registries if you enabled client-side experimental features. I was able to use VSTS and create a custom build task for multi-arch tags after the build. I followed this pattern.

docker manifest create --amend {multi-arch-tag} {os-specific-tag-1} {os-specific-tag-2}
docker manifest annotate {multi-arch-tag} {os-specific-tag-1} --os {os-1} --arch {arch-1}
docker manifest annotate {multi-arch-tag} {os-specific-tag-2} --os {os-2} --arch {arch-2}
docker manifest push --purge {multi-arch-tag}

On a side note, I packaged the 18.02 docker CLI for Windows and Linux in my custom VSTS task so no install of docker was required. The manifest command does not appear to need the docker daemon to function correctly.

like image 117
Aaron Stainback Avatar answered Nov 15 '22 06:11

Aaron Stainback