Skip to content

Commit 77477e8

Browse files
committed
Build GCC and push, with digest only
1 parent 61d7253 commit 77477e8

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

.github/workflows/debian.yml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
paths:
66
- .github/workflows/debian.yml
7-
- docker/debian/Dockerfile
7+
- docker/debian/Dockerfile*
88
- test
99
workflow_dispatch:
1010

@@ -96,6 +96,38 @@ jobs:
9696
echo "CONTAINER_REPOSITORY_GCC=${CONTAINER_REPO}/debian-gcc" >> $GITHUB_ENV
9797
echo "CONTAINER_IMAGE_GCC=${CONTAINER_REGISTRY}/${CONTAINER_REPO}/debian-gcc" >> $GITHUB_ENV
9898
fi
99+
- name: Prepare gcc image metadata
100+
if: ${{ env.CONTAINER_IMAGE_GCC }}
101+
id: meta-gcc
102+
uses: docker/metadata-action@v5
103+
env:
104+
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,manifest-descriptor
105+
with:
106+
images: ${{ env.CONTAINER_IMAGE_GCC }}
107+
labels: |
108+
org.opencontainers.image.authors=For inquiries, please use https://${{ github.repository }}/issues
109+
org.opencontainers.image.documentation=https://${{ github.repository }}
110+
org.opencontainers.image.vendor=XRPLF
111+
org.opencontainers.image.title=${{ env.CONTAINER_REPOSITORY_GCC }}
112+
- name: Build gcc image
113+
# Note, we always push this image, otherwise steps.build will fail.
114+
# Also, because we always push it, we intentionally do not tag it.
115+
# TODO: Move to separate workflow or job
116+
if: ${{ env.CONTAINER_IMAGE_GCC }}
117+
id: build-gcc
118+
uses: docker/build-push-action@v6
119+
with:
120+
build-args: |
121+
BUILDKIT_DOCKERFILE_CHECK=skip=InvalidDefaultArgInFrom
122+
BUILDKIT_INLINE_CACHE=1
123+
context: .
124+
file: docker/debian/Dockerfile.gcc-${{ matrix.os.compiler_version }}-${{ matrix.os.release }}
125+
outputs: type=image,name=${{ env.CONTAINER_IMAGE_GCC }},push-by-digest=true,name-canonical=true,push=true
126+
platforms: ${{ matrix.architecture.platform }}
127+
provenance: mode=max
128+
push: true
129+
sbom: true
130+
labels: ${{ steps.meta-gcc.outputs.labels }}
99131
- name: Prepare container metadata
100132
id: meta
101133
uses: docker/metadata-action@v5
@@ -124,7 +156,7 @@ jobs:
124156
GCOVR_VERSION=${{ env.GCOVR_VERSION }}
125157
CMAKE_VERSION=${{ env.CMAKE_VERSION }}
126158
DEBIAN_VERSION=${{ matrix.os.release }}
127-
BASE_IMAGE=${{ env.CONTAINER_IMAGE_GCC && format('{0}:{1}-{2}', env.CONTAINER_IMAGE_GCC, matrix.os.compiler_version, matrix.os.release) || format('gcc:{0}-{1}', matrix.os.compiler_version, matrix.os.release) }}
159+
BASE_IMAGE=${{ env.CONTAINER_IMAGE_GCC && format('{0}@{1}', steps.build-gcc.outputs.digest) || format('gcc:{0}-{1}', matrix.os.compiler_version, matrix.os.release) }}
128160
context: .
129161
file: docker/debian/Dockerfile
130162
outputs: type=image,name=${{ env.CONTAINER_IMAGE }},push-by-digest=true,name-canonical=true,push=true

0 commit comments

Comments
 (0)