From 93c7e0be6654342c55940fc60411df607cfd30ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 1 Nov 2023 09:50:53 +0100 Subject: [PATCH] build: include annotations in the multi-arch images This needs --annotations support in buildx which was introduced in Docker buildx 0.12.0. --- .github/bin/docker-build | 2 ++ .github/bin/get-buildx-args | 4 ++++ .github/workflows/bleeding.yml | 24 ++++++++++++------------ .github/workflows/dockerimage.yml | 24 ++++++++++++------------ 4 files changed, 30 insertions(+), 24 deletions(-) create mode 100755 .github/bin/docker-build diff --git a/.github/bin/docker-build b/.github/bin/docker-build new file mode 100755 index 000000000..cfa55ad5b --- /dev/null +++ b/.github/bin/docker-build @@ -0,0 +1,2 @@ +#!/bin/sh +eval "docker buildx build $(.github/bin/get-buildx-args "$@" | sed 's/$/ /' | tr -d \\n)" diff --git a/.github/bin/get-buildx-args b/.github/bin/get-buildx-args index 4cf44a690..c64c1036f 100755 --- a/.github/bin/get-buildx-args +++ b/.github/bin/get-buildx-args @@ -11,6 +11,10 @@ else done fi +# Expose annotations +WEBLATE_VERSION=$(sed -n 's/^ENV WEBLATE_VERSION \(.*\)/\1/p' Dockerfile) +sed -n "s/^LABEL \(org.opencontainers.image.*\)/--annotation \1/p" Dockerfile | sed -e "s/\\\$WEBLATE_VERSION/$WEBLATE_VERSION/" + # Write to local cache unless publishing (not compatible with push) if [ "$1" != "publish" ] ; then echo --cache-to "type=local,dest=/tmp/.buildx-cache/$MATRIX_ARCHITECTURE,mode=max" diff --git a/.github/workflows/bleeding.yml b/.github/workflows/bleeding.yml index 1dca1f2d5..37c36823e 100644 --- a/.github/workflows/bleeding.yml +++ b/.github/workflows/bleeding.yml @@ -50,7 +50,7 @@ jobs: - name: Configure Docker build run: .github/bin/get-buildx-args - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args) + run: .github/bin/docker-build buildx: runs-on: ubuntu-22.04 @@ -85,7 +85,7 @@ jobs: - name: Configure Docker build run: .github/bin/get-buildx-args - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args) + run: .github/bin/docker-build test: runs-on: ubuntu-22.04 @@ -119,7 +119,7 @@ jobs: - name: Adjust bleeding edge image run: .github/bin/bleeding ${{needs.bleeding.outputs.weblate_sha}} ${{needs.bleeding.outputs.weblate_date}} - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args load) + run: .github/bin/docker-build load - name: List Docker images run: docker image ls --all - name: Generate configuration @@ -176,7 +176,7 @@ jobs: - name: Adjust bleeding edge image run: .github/bin/bleeding ${{needs.bleeding.outputs.weblate_sha}} ${{needs.bleeding.outputs.weblate_date}} - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args load) + run: .github/bin/docker-build load - name: List Docker images run: docker image ls --all - name: Generate configuration @@ -261,7 +261,7 @@ jobs: - name: Adjust bleeding edge image run: .github/bin/bleeding ${{needs.bleeding.outputs.weblate_sha}} ${{needs.bleeding.outputs.weblate_date}} - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args load) + run: .github/bin/docker-build load - name: List Docker images run: docker image ls --all - name: Generate configuration @@ -346,7 +346,7 @@ jobs: - name: Adjust bleeding edge image run: .github/bin/bleeding ${{needs.bleeding.outputs.weblate_sha}} ${{needs.bleeding.outputs.weblate_date}} - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args load) + run: .github/bin/docker-build load - name: List Docker images run: docker image ls --all - name: Generate configuration @@ -433,7 +433,7 @@ jobs: - name: Adjust bleeding edge image run: .github/bin/bleeding ${{needs.bleeding.outputs.weblate_sha}} ${{needs.bleeding.outputs.weblate_date}} - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args load) + run: .github/bin/docker-build load - name: List Docker images run: docker image ls --all - name: Generate configuration @@ -514,7 +514,7 @@ jobs: - name: Adjust bleeding edge image run: .github/bin/bleeding ${{needs.bleeding.outputs.weblate_sha}} ${{needs.bleeding.outputs.weblate_date}} - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args load) + run: .github/bin/docker-build load - name: List Docker images run: docker image ls --all - name: Generate configuration @@ -600,7 +600,7 @@ jobs: - name: Adjust bleeding edge image run: .github/bin/bleeding ${{needs.bleeding.outputs.weblate_sha}} ${{needs.bleeding.outputs.weblate_date}} - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args load) + run: .github/bin/docker-build load - name: List Docker images run: docker image ls --all - name: Checkout the code @@ -649,7 +649,7 @@ jobs: - name: Adjust bleeding edge image run: .github/bin/bleeding ${{needs.bleeding.outputs.weblate_sha}} ${{needs.bleeding.outputs.weblate_date}} - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args load) + run: .github/bin/docker-build load - name: List Docker images run: docker image ls --all - name: Checkout the code @@ -717,7 +717,7 @@ jobs: - name: Configure Docker build run: .github/bin/get-buildx-args publish-bleeding - name: Publish the Docker images - run: docker buildx build $(.github/bin/get-buildx-args publish-bleeding) + run: .github/bin/docker-build publish-bleeding push_github: runs-on: ubuntu-22.04 @@ -773,4 +773,4 @@ jobs: - name: Configure Docker build run: .github/bin/get-buildx-args publish-bleeding - name: Publish the Docker images - run: docker buildx build $(.github/bin/get-buildx-args publish-bleeding) + run: .github/bin/docker-build publish-bleeding diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index 9b9f99f7c..5c9ed731c 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -36,7 +36,7 @@ jobs: - name: Configure Docker build run: .github/bin/get-buildx-args - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args) + run: .github/bin/docker-build buildx: runs-on: ubuntu-22.04 @@ -67,7 +67,7 @@ jobs: - name: Configure Docker build run: .github/bin/get-buildx-args - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args) + run: .github/bin/docker-build test: runs-on: ubuntu-22.04 @@ -97,7 +97,7 @@ jobs: path: /tmp/.buildx-cache/${{ matrix.architecture }} key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.architecture }} - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args load) + run: .github/bin/docker-build load - name: List Docker images run: docker image ls --all - name: Generate configuration @@ -150,7 +150,7 @@ jobs: path: /tmp/.buildx-cache/${{ matrix.architecture }} key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.architecture }} - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args load) + run: .github/bin/docker-build load - name: List Docker images run: docker image ls --all - name: Generate configuration @@ -231,7 +231,7 @@ jobs: path: /tmp/.buildx-cache/${{ matrix.architecture }} key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.architecture }} - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args load) + run: .github/bin/docker-build load - name: List Docker images run: docker image ls --all - name: Generate configuration @@ -312,7 +312,7 @@ jobs: path: /tmp/.buildx-cache/${{ matrix.architecture }} key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.architecture }} - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args load) + run: .github/bin/docker-build load - name: List Docker images run: docker image ls --all - name: Generate configuration @@ -395,7 +395,7 @@ jobs: path: /tmp/.buildx-cache/${{ matrix.architecture }} key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.architecture }} - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args load) + run: .github/bin/docker-build load - name: List Docker images run: docker image ls --all - name: Generate configuration @@ -472,7 +472,7 @@ jobs: path: /tmp/.buildx-cache/${{ matrix.architecture }} key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.architecture }} - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args load) + run: .github/bin/docker-build load - name: List Docker images run: docker image ls --all - name: Generate configuration @@ -555,7 +555,7 @@ jobs: path: /tmp/.buildx-cache/${{ matrix.architecture }} key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.architecture }} - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args load) + run: .github/bin/docker-build load - name: List Docker images run: docker image ls --all - name: Checkout the code @@ -601,7 +601,7 @@ jobs: path: /tmp/.buildx-cache/${{ matrix.architecture }} key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.architecture }} - name: Build the Docker image - run: docker buildx build $(.github/bin/get-buildx-args load) + run: .github/bin/docker-build load - name: List Docker images run: docker image ls --all - name: Checkout the code @@ -666,7 +666,7 @@ jobs: - name: Configure Docker build run: .github/bin/get-buildx-args publish - name: Publish the Docker images - run: docker buildx build $(.github/bin/get-buildx-args publish) + run: .github/bin/docker-build publish push_github: runs-on: ubuntu-22.04 @@ -719,4 +719,4 @@ jobs: - name: Configure Docker build run: .github/bin/get-buildx-args publish - name: Publish the Docker images - run: docker buildx build $(.github/bin/get-buildx-args publish) + run: .github/bin/docker-build publish