noseyparker icon indicating copy to clipboard operation
noseyparker copied to clipboard

Rework multi-platform Docker builds in GitHub Actions

Open bradlarsen opened this issue 1 year ago • 2 comments

Nosey Parker's currently uses GitHub Actions to build Docker images, including a multi-platform x86_64 and aarch64 image for releases.

There are a few deficiencies with this current setup:

  • The multi-platform images use QEMU to build both platforms on a single x86_64 machine. This is very slow, taking nearly 2 hours, with almost all of that time spent building for the non-native aarch64 platform
  • Because the multi-platform images are so expensive to build, they are only done for release builds, and not every single commit
  • The multi-platform images lack fully populated Docker image metadata, due to bugs / limitations in the docker/build-push-action action (#91)

GitHub Actions now has native aarch64 runners. It is probably possible to build the x86_64 and aarch64 Docker images separately within just a few minutes, each on a native runner, and then in a later Actions job, stitch those two Docker images together with the appropriate metadata into a multi-platform Docker image.

bradlarsen avatar Mar 22 '24 15:03 bradlarsen

Although GitHub has native ARM runners, it appears that they are still in private beta that you have to sign up for: https://github.blog/changelog/2023-10-30-accelerate-your-ci-cd-with-arm-based-hosted-runners-in-github-actions/

bradlarsen avatar Mar 29 '24 02:03 bradlarsen

We are now using the new Linux ARM64 runners for regular CI jobs and for building release artifacts: https://github.com/praetorian-inc/noseyparker/pull/197. (The runners that we set up for that are named ubuntu-22.04-arm64-8-core and ubuntu-24.04-arm64-8-core.)

The Docker-building workflows still need to be updated to use those runners, build each single platform's image independently, and then merge them together into a multi-platform image.

bradlarsen avatar Jun 27 '24 15:06 bradlarsen