@@ -230,7 +230,7 @@ jobs:
230230 fail_ci_if_error : false
231231 docker-scan :
232232 runs-on : ubuntu-latest
233- timeout-minutes : 20
233+ timeout-minutes : 45
234234 needs : [changed_files, ci]
235235 if : |
236236 ${{ github.event.pull_request.draft == false && needs.changed_files.outputs.changed-docker-files == 'true' }}
@@ -242,23 +242,68 @@ jobs:
242242 egress-policy : audit
243243 - name : Checkout Code
244244 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
245+ - name : Setup QEMU
246+ uses : docker/setup-qemu-action@e77e8065d9f7ec6abdd9838668cd7b43924dd64d # main
247+ with :
248+ platforms : linux/amd64,linux/arm64
245249 - name : Prepare
246250 id : init
247251 uses : ./.github/actions/prepare
248252 - name : Set up Docker Buildx
249253 uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
250- - name : Build local container
254+ - name : Build x86 local container
251255 uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
252256 with :
253- tags : openzeppelin-monitor-dev:${{ github.sha }}
257+ tags : openzeppelin-monitor-dev:${{ github.sha }}-amd64
254258 push : false
255259 load : true
256260 file : Dockerfile.development
257261 platforms : linux/amd64
262+ # - name: Build arm64 local container
263+ # uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
264+ # with:
265+ # tags: openzeppelin-monitor-dev:${{ github.sha }}-arm64
266+ # push: false
267+ # load: true
268+ # file: Dockerfile.development
269+ # platforms: linux/arm64
270+ - name : Test image and binary architectures
271+ run : |
272+ set -euo pipefail
273+ # platforms=("amd64" "arm64")
274+ platforms=("amd64")
275+ for platform in "${platforms[@]}"; do
276+ image_tag="openzeppelin-monitor-dev:${{ github.sha }}-${platform}"
277+ echo ">>>>>>>>Inspecting $platform<<<<<<<<"
278+ image_arch=$(docker image inspect $image_tag --format '{{.Architecture}}')
279+ binary_info=$(docker run --rm --platform linux/$platform --entrypoint sh $image_tag -c \
280+ "apk add --no-cache file >/dev/null && file openzeppelin-monitor")
281+ echo ">>>>>>>>Binary info: $binary_info<<<<<<<<"
282+
283+ # Determine binary architecture
284+ case "$binary_info" in
285+ *"ARM aarch64"*)
286+ binary_arch="arm64"
287+ ;;
288+ *"x86-64"*)
289+ binary_arch="amd64"
290+ ;;
291+ *)
292+ echo "Unknown binary architecture: $binary_info........."
293+ exit 1
294+ ;;
295+ esac
296+ echo ">>>>>>>>Image arch: $image_arch | Binary arch: $binary_arch<<<<<<<<"
297+ if [ "$image_arch" != "$binary_arch" ]; then
298+ echo ">>>>>>>Architecture mismatch: Image=$image_arch Binary=$binary_arch<<<<<<<"
299+ exit 1
300+ fi
301+ echo ">>>>>>>Architecture match for $platform<<<<<<<<"
302+ done
258303 - name : Scan image
259304 uses : anchore/scan-action@f6601287cdb1efc985d6b765bbf99cb4c0ac29d8 # v7.0.0
260305 with :
261- image : openzeppelin-monitor-dev:${{ github.sha }}
306+ image : openzeppelin-monitor-dev:${{ github.sha }}-amd64
262307 fail-build : true
263308 severity-cutoff : high
264309 output-format : table
0 commit comments