Skip to content

Commit

Permalink
build: include annotations in the multi-arch images
Browse files Browse the repository at this point in the history
This needs --annotations support in buildx which was introduced in
Docker buildx 0.12.0.
  • Loading branch information
nijel committed Nov 18, 2023
1 parent bb578b3 commit 78f1170
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
4 changes: 4 additions & 0 deletions .github/bin/get-buildx-args
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/bleeding.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args)"

buildx:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args)"

test:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args load)"
- name: List Docker images
run: docker image ls --all
- name: Generate configuration
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args load)"
- name: List Docker images
run: docker image ls --all
- name: Generate configuration
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args load)"
- name: List Docker images
run: docker image ls --all
- name: Generate configuration
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args load)"
- name: List Docker images
run: docker image ls --all
- name: Generate configuration
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args load)"
- name: List Docker images
run: docker image ls --all
- name: Generate configuration
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args load)"
- name: List Docker images
run: docker image ls --all
- name: Generate configuration
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args load)"
- name: List Docker images
run: docker image ls --all
- name: Checkout the code
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args load)"
- name: List Docker images
run: docker image ls --all
- name: Checkout the code
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args publish-bleeding)"

push_github:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args publish-bleeding)"
24 changes: 12 additions & 12 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args)"

buildx:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args)"

test:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args load)"
- name: List Docker images
run: docker image ls --all
- name: Generate configuration
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args load)"
- name: List Docker images
run: docker image ls --all
- name: Generate configuration
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args load)"
- name: List Docker images
run: docker image ls --all
- name: Generate configuration
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args load)"
- name: List Docker images
run: docker image ls --all
- name: Generate configuration
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args load)"
- name: List Docker images
run: docker image ls --all
- name: Generate configuration
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args load)"
- name: List Docker images
run: docker image ls --all
- name: Generate configuration
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args load)"
- name: List Docker images
run: docker image ls --all
- name: Checkout the code
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args load)"
- name: List Docker images
run: docker image ls --all
- name: Checkout the code
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args publish)"

push_github:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -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: eval "docker buildx build $(.github/bin/get-buildx-args publish)"

0 comments on commit 78f1170

Please sign in to comment.