@@ -21,15 +21,22 @@ concurrency:
2121 group : docker-${{ github.workflow }}-${{ github.ref }}
2222 cancel-in-progress : false
2323
24- # Instructions from https://depot.dev/blog/multi-platform-docker-images-in-github-actions
2524jobs :
26- docker-release-ubuntu :
27- runs-on : ubuntu-latest
25+ build-and-release :
26+
27+ strategy :
28+ matrix :
29+ os : [ubuntu, redhat]
30+ runner : [latest, 24.04-arm]
31+
32+ runs-on : ubuntu-${{ matrix.runner }}
33+
2834 permissions :
2935 packages : write
3036 contents : read
3137 attestations : write
3238 id-token : write
39+
3340 steps :
3441 - uses : actions/checkout@v4
3542
@@ -40,28 +47,24 @@ jobs:
4047 username : ${{ github.actor }}
4148 password : ${{ secrets.GITHUB_TOKEN }}
4249
43- - name : Set up QEMU
44- uses : docker/setup-qemu-action@v3.4.0
45- - name : Set up Docker Buildx
46- uses : docker/setup-buildx-action@v3
47-
48- - name : Build multi-platform image
50+ - name : Build ${{ matrix.os }}-${{ matrix.runner }} image
4951 uses : docker/build-push-action@v5
5052 with :
5153 context : .
52- platforms : linux/amd64,linux/arm64
5354 push : ${{ github.event_name != 'pull_request' }}
54- tags : ${{env.CN_IMAGE_ID}}:release
55- file : Dockerfile.ubuntu
55+ tags : ${{ env.CN_IMAGE_ID }}:release-${{ matrix.os }}-${{ matrix.runner }}
56+ file : Dockerfile.${{ matrix.os }}
57+ attests : type=sbom
58+ provenance : mode=max
5659 github-token : ${{ secrets.GITHUB_TOKEN }}
5760
58- docker-release-redhat :
61+ combine-multiplatform :
62+ strategy :
63+ matrix :
64+ os : [ubuntu, redhat]
65+
5966 runs-on : ubuntu-latest
60- permissions :
61- packages : write
62- contents : read
63- attestations : write
64- id-token : write
67+ needs : [build-and-release]
6568 steps :
6669 - uses : actions/checkout@v4
6770
@@ -72,35 +75,28 @@ jobs:
7275 username : ${{ github.actor }}
7376 password : ${{ secrets.GITHUB_TOKEN }}
7477
75- - name : Set up QEMU
76- uses : docker/setup-qemu-action@v3.4.0
77- - name : Set up Docker Buildx
78- uses : docker/setup-buildx-action@v3
79-
80- - name : Build multi-platform image
81- uses : docker/build-push-action@v5
82- with :
83- context : .
84- platforms : linux/amd64,linux/arm64
85- push : ${{ github.event_name != 'pull_request' }}
86- tags : ${{env.CN_IMAGE_ID}}:release-redhat
87- file : Dockerfile.redhat
88- attests : type=sbom
89- provenance : mode=max
90- github-token : ${{ secrets.GITHUB_TOKEN }}
78+ - name : Create ${{ matrix.os }} manifest and push
79+ run : |
80+ docker manifest create \
81+ ${{ env.CN_IMAGE_ID }}:release-${{ matrix.os }} \
82+ --amend ${{ env.CN_IMAGE_ID }}:release-${{ matrix.os }}-latest \
83+ --amend ${{ env.CN_IMAGE_ID }}:release-${{ matrix.os }}-24.04-arm \
9184
9285# Other CI is testing anyway - if need be, can run tests in Dockerfile itself
9386 test-docker-images :
94- runs-on : ubuntu-latest
87+
9588 if : ${{ github.event_name != 'pull_request' }}
96- needs : [docker-release-redhat, docker-release-ubuntu]
89+
9790 strategy :
9891 matrix :
99- tag : [release, release-redhat]
92+ os : [ubuntu, redhat]
93+ runs-on : ubuntu-latest
94+ needs : [build-and-release]
95+
10096 steps :
10197 - uses : actions/checkout@v4
10298
103- - name : Run CN CI tests
99+ - name : Run CI tests
104100 run : |
105- docker pull ${{env.CN_IMAGE_ID}}:${{ matrix.tag }}
106- docker run -v $PWD:/work -w /work ${{env.CN_IMAGE_ID}}:${{ matrix.tag }} bash tests/run-cn.sh
101+ docker pull ${{env.CN_IMAGE_ID}}:release- ${{ matrix.os }}
102+ docker run -v $PWD:/work -w /work ${{env.CN_IMAGE_ID}}:release- ${{ matrix.os }} bash tests/run-cn.sh
0 commit comments