diff --git a/.gitlab/ci/definitions.yml b/.gitlab/ci/definitions.yml index b76b233..3fb8a05 100644 --- a/.gitlab/ci/definitions.yml +++ b/.gitlab/ci/definitions.yml @@ -36,16 +36,17 @@ # Hack to set an array in /bin/sh # http://unix.stackexchange.com/a/137571 - set -- $CI_JOB_NAME + - export IMAGE_NAME=${1/:/} - | docker buildx build \ --cache-to=type=inline \ - --cache-from="$CI_REGISTRY_IMAGE:$1" \ + --cache-from="$CI_REGISTRY_IMAGE:$IMAGE_NAME" \ --platform=linux/${ARCH:-amd64} \ --push="${PUSH_CUSTOM_IMAGE:-false}" \ --label "ci_pipeline_url=$CI_PIPELINE_URL" \ --label "ci_job_url=$CI_JOB_URL" \ - -t "$CI_REGISTRY_IMAGE:$1" \ - -f "Dockerfile.$1" \ + -t "$CI_REGISTRY_IMAGE:$IMAGE_NAME" \ + -f "Dockerfile.$IMAGE_NAME" \ . rules: - if: '$CI_PIPELINE_SOURCE == "schedule"' diff --git a/README.md b/README.md index 99712db..93276a9 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,16 @@ new-image: extends: .build_static_image ``` +**NOTE:** You can use `parallel:matrix` keyword to build images for multiple architectures: + +```yml +new-image: + extends: .build_static_image + parallel: + matrix: + - ARCH: [ 'arm64', 'amd64' ] +``` + 1. Add a Dockerfile: `Dockerfile.new-image`. ### Use a custom image with versioned features