From 9b1efaf507c71759ef42484562132c6d2d202176 Mon Sep 17 00:00:00 2001 From: Maximilian Irro Date: Thu, 26 Sep 2024 20:24:13 +0200 Subject: [PATCH] Set OpenContainers Annotations as Docker labels using Docker metadata action --- .github/workflows/ci.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2408eab7..0433ebe2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -46,6 +46,11 @@ jobs: go-version-file: go.mod - name: "[preparation] set up qemu" uses: docker/setup-qemu-action@v3.0.0 + - name: '[preparation] extract docker metadata' + id: meta + uses: docker/metadata-action@v5.5.1 + with: + images: ${DOCKER_HUB_REPO} - name: "[preparation] set up docker context for buildx" run: docker context create builders - name: "[preparation] set up docker buildx" @@ -84,10 +89,10 @@ jobs: - name: "[execution] build and push docker images" run: | if [ "${{ matrix.config.platform }}" == "windows" ]; then - docker buildx build --output=type=registry --attest type=provenance,mode=max --attest type=sbom,disabled=false --platform ${{ matrix.config.platform }}/${{ matrix.config.arch }} --build-arg OSVERSION=${{ matrix.config.version }} -t "${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}" -f build/${{ matrix.config.platform }}/Dockerfile . + docker buildx build --output=type=registry --attest type=provenance,mode=max --attest type=sbom,disabled=false --platform ${{ matrix.config.platform }}/${{ matrix.config.arch }} --label ${{ steps.meta.outputs.labels }} --build-arg OSVERSION=${{ matrix.config.version }} -t "${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}" -f build/${{ matrix.config.platform }}/Dockerfile . else - docker buildx build --output=type=registry --attest type=provenance,mode=max --attest type=sbom,disabled=false --platform ${{ matrix.config.platform }}/${{ matrix.config.arch }} -t "${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}" -f build/${{ matrix.config.platform }}/Dockerfile . - docker buildx build --output=type=registry --attest type=provenance,mode=max --attest type=sbom,disabled=false --platform ${{ matrix.config.platform }}/${{ matrix.config.arch }} -t "${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-alpine" -f build/${{ matrix.config.platform }}/alpine.Dockerfile . + docker buildx build --output=type=registry --attest type=provenance,mode=max --attest type=sbom,disabled=false --platform ${{ matrix.config.platform }}/${{ matrix.config.arch }} --label ${{ steps.meta.outputs.labels }} -t "${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}" -f build/${{ matrix.config.platform }}/Dockerfile . + docker buildx build --output=type=registry --attest type=provenance,mode=max --attest type=sbom,disabled=false --platform ${{ matrix.config.platform }}/${{ matrix.config.arch }} --label ${{ steps.meta.outputs.labels }} -t "${DOCKER_HUB_REPO}:${CONTAINER_IMAGE_TAG}-alpine" -f build/${{ matrix.config.platform }}/alpine.Dockerfile . fi env: CONTAINER_IMAGE_TAG: ${{ env.CONTAINER_IMAGE_TAG }}