FAQ | This is a LIVE service | Changelog

Skip to content

Migrate to buildx for multi-arch builds

Ryan Kowalewski requested to merge multi-arch-builds into master

This MR will switch the build process to use docker buildx to support multi-platform images where required.

Testing this process showed that multi-platform builds can be quite flaky or extremely slow, depending on the complexities of each image's Dockerfile etc. With this in mind, the MR leaves the default image type as linux/amd64 but allows us to override each build job as required using the IMAGE_ARCHS variable.

Initially, all logan-terraform jobs have been set to build both amd64 and arm64 image types as this is the main requirement at this time.

Given the differences between the docker build and docker buildx build command usage, I've refactored the previous functions into a single build.sh file. The logic should be identical to the previous functions, however, the method is slightly different. This is mostly due to the docker buildx command not having the tag sub-command, instead, it uses --tag and --push options on a single docker buildx build command to both build and push images in one go.

Here is an example pipeline where all images build successfully but are not pushed to any registries - https://gitlab.developers.cam.ac.uk/uis/devops/infra/dockerimages/-/pipelines/378302

And here is an example pipeline where all images build successfully and are pushed to the GitLab registry - https://gitlab.developers.cam.ac.uk/uis/devops/infra/dockerimages/-/pipelines/378311

Closes #58 (closed) Part of https://gitlab.developers.cam.ac.uk/uis/devops/devhub/gitlab-runner-infrastructure/-/issues/9

Edited by Ryan Kowalewski

Merge request reports

Loading