Enable multi-platform image builds with docker buildx

Given PR propose an alternative build back-end that allow multi-platform build & test of LAVA docker images.

Major changes/improvements:

  • aarch64 & arm64 merged to a single dockerfiles directories following below structure:
    dockerfiles/
         └── <IMAGE_NAME>
              ├── flavor-a.Dockerfile
              ├── flavor-b.Dockerfile
              └── test.sh
    
    # Dockerfiles are still created from Jinja2 templates extending base.jinja2
    share/templates/
         └── <IMAGE_NAME>
              ├── flavor-a.Dockerfile.jinja2
              └── flavor-b.Dockerfile.jina2
    • Files (eg: test.sh) are no longer duplicated in every platform/debian version.
    • Dependencies are identical not matter the platform, such as tests
  • Multi-stage base.jinja2
    • build -> test -> final
    • build: legacy base.jinja2 including few optimizations related to cache.
    • test: new Execute tests.sh and store logs in /var/log/ci_tests.log
    • final: new Create the final image from scratch and copy rootfs from build (single layer image)
      Note: tests logs are included in final to keep a dependency on test stage (ensure test execution during image build)
  • Add docker-bake.hcl
    • Replacement for build.sh
    • Store all available targets
  • Add Makefile: used in gitlab-ci, act as shortcut for few actions on the project
  • Gitlab-CI
    • Build all images for all supported platform (excluding analyze which remains amd64 only)
    • Add final stage creating multi-platform manifests
    • Change runner to saas-linux-small-arm64 for arm64 jobs. medium is only available with paid versions of gitlab.
  • Container Registry
    • Naming convention changed to limit the number of docker repositories
    • Flavors are platforms are specified in tags
    • Service set the repository name
    • Platform specific tag: ci-image/dispatcher:debian-12-arm64
    • Multi-platform tag: ci-image/dispatcher:debian-12

Screenshots from registry:

image

image

Signed-off-by: Thomas Mahé thomas.mahe@nxp.com

Edited by Mahe Thomas

Merge request reports

Loading