1414 workflow_dispatch :
1515 inputs :
1616 use_cache :
17- description : ' Use Docker build cache'
17+ description : " Use Docker build cache"
1818 required : false
19- default : ' true'
19+ default : " true"
2020 type : choice
2121 options :
22- - ' true'
23- - ' false'
22+ - " true"
23+ - " false"
2424
2525env :
2626 REGISTRY : ghcr.io
3838 sudo rm -rf /usr/share/dotnet
3939 sudo rm -rf "$AGENT_TOOLSDIRECTORY"
4040
41- - uses : actions/checkout@v4
41+ - uses : actions/checkout@v5
4242
4343 - name : Log in to the Container registry
4444 uses : docker/login-action@v3
@@ -59,20 +59,39 @@ jobs:
5959 type=semver,pattern={{major}}.{{minor}}
6060
6161 - name : Set up Docker Buildx
62- uses : docker/setup-buildx-action@v2
62+ uses : docker/setup-buildx-action@v3
6363
6464 - name : Build and push API Docker image
65+ id : build_api
6566 uses : docker/build-push-action@v6
6667 with :
6768 context : backend/
6869 file : backend/Dockerfile.API
70+ platforms : linux/amd64
71+ provenance : false
72+ sbom : false
6973 push : true
7074 tags : ${{ steps.meta_api.outputs.tags }}
7175 labels : ${{ steps.meta_api.outputs.labels }}
7276 cache-from : ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.use_cache == 'false') && '' || 'type=gha,scope=api,timeout=20m' }}
7377 cache-to : ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.use_cache == 'false') && '' || 'type=gha,mode=max,scope=api,timeout=20m,ignore-error=true' }}
7478 github-token : ${{ secrets.GITHUB_TOKEN }}
7579
80+ - name : Validate API manifest
81+ env :
82+ IMAGE_REF : ${{ env.REGISTRY }}/${{ github.repository_owner }}/fair-api@${{ steps.build_api.outputs.digest }}
83+ run : |
84+ json=$(docker buildx imagetools inspect --format '{{json .}}' "$IMAGE_REF")
85+ echo "$json" | jq -e '
86+ if (.manifest.manifests? | type) == "array" then
87+ (any(.manifest.manifests[]?; .platform.os == "linux" and .platform.architecture == "amd64"))
88+ and
89+ (all(.manifest.manifests[]?; (.platform.os != "unknown" and .platform.architecture != "unknown")))
90+ else
91+ (.image.os == "linux" and .image.architecture == "amd64")
92+ end
93+ ' >/dev/null
94+
7695 build-and-push-worker-image :
7796 needs : build-and-push-api-image
7897 runs-on : ubuntu-24.04
88107 sudo rm -rf /usr/share/dotnet
89108 sudo rm -rf "$AGENT_TOOLSDIRECTORY"
90109
91- - uses : actions/checkout@v4
110+ - uses : actions/checkout@v5
92111
93112 - name : Log in to the Container registry
94113 uses : docker/login-action@v3
@@ -109,13 +128,17 @@ jobs:
109128 type=semver,pattern={{major}}.{{minor}},suffix=-${{ matrix.build_type }}
110129
111130 - name : Set up Docker Buildx
112- uses : docker/setup-buildx-action@v2
131+ uses : docker/setup-buildx-action@v3
113132
114133 - name : Build and push Worker Docker image (${{ matrix.build_type }})
134+ id : build_worker
115135 uses : docker/build-push-action@v6
116136 with :
117137 context : backend/
118138 file : backend/Dockerfile.workers
139+ platforms : linux/amd64
140+ provenance : false
141+ sbom : false
119142 push : true
120143 build-args : |
121144 BUILD_TYPE=${{ matrix.build_type }}
@@ -125,6 +148,21 @@ jobs:
125148 cache-to : ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.use_cache == 'false') && '' || format('type=gha,mode=min,scope=docker-worker-{0},timeout=20m,ignore-error=true', matrix.build_type) }}
126149 github-token : ${{ secrets.GITHUB_TOKEN }}
127150
151+ - name : Validate Worker manifest
152+ env :
153+ IMAGE_REF : ${{ env.REGISTRY }}/${{ github.repository_owner }}/fair-worker@${{ steps.build_worker.outputs.digest }}
154+ run : |
155+ json=$(docker buildx imagetools inspect --format '{{json .}}' "$IMAGE_REF")
156+ echo "$json" | jq -e '
157+ if (.manifest.manifests? | type) == "array" then
158+ (any(.manifest.manifests[]?; .platform.os == "linux" and .platform.architecture == "amd64"))
159+ and
160+ (all(.manifest.manifests[]?; (.platform.os != "unknown" and .platform.architecture != "unknown")))
161+ else
162+ (.image.os == "linux" and .image.architecture == "amd64")
163+ end
164+ ' >/dev/null
165+
128166 build-and-push-offline-predictor-image :
129167 runs-on : ubuntu-24.04
130168 needs : build-and-push-api-image
@@ -137,7 +175,7 @@ jobs:
137175 sudo rm -rf /usr/share/dotnet
138176 sudo rm -rf "$AGENT_TOOLSDIRECTORY"
139177
140- - uses : actions/checkout@v4
178+ - uses : actions/checkout@v5
141179
142180 - name : Log in to the Container registry
143181 uses : docker/login-action@v3
@@ -158,13 +196,17 @@ jobs:
158196 type=semver,pattern={{major}}.{{minor}}
159197
160198 - name : Set up Docker Buildx
161- uses : docker/setup-buildx-action@v2
199+ uses : docker/setup-buildx-action@v3
162200
163201 - name : Build and push Offline Predictor Docker image
202+ id : build_offline_predictor
164203 uses : docker/build-push-action@v6
165204 with :
166205 context : backend/
167206 file : backend/Dockerfile.API
207+ platforms : linux/amd64
208+ provenance : false
209+ sbom : false
168210 push : true
169211 build-args : |
170212 BUILD_TARGET=predictor
@@ -173,3 +215,18 @@ jobs:
173215 cache-from : ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.use_cache == 'false') && '' || 'type=gha,scope=offline-predictor,timeout=20m' }}
174216 cache-to : ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.use_cache == 'false') && '' || 'type=gha,mode=max,scope=offline-predictor,timeout=20m,ignore-error=true' }}
175217 github-token : ${{ secrets.GITHUB_TOKEN }}
218+
219+ - name : Validate Offline Predictor manifest
220+ env :
221+ IMAGE_REF : ${{ env.REGISTRY }}/${{ github.repository_owner }}/fair-offline-predictor@${{ steps.build_offline_predictor.outputs.digest }}
222+ run : |
223+ json=$(docker buildx imagetools inspect --format '{{json .}}' "$IMAGE_REF")
224+ echo "$json" | jq -e '
225+ if (.manifest.manifests? | type) == "array" then
226+ (any(.manifest.manifests[]?; .platform.os == "linux" and .platform.architecture == "amd64"))
227+ and
228+ (all(.manifest.manifests[]?; (.platform.os != "unknown" and .platform.architecture != "unknown")))
229+ else
230+ (.image.os == "linux" and .image.architecture == "amd64")
231+ end
232+ ' >/dev/null
0 commit comments