arm64-attach: PHP parity via a BuildKit run (docker run of arm64 fails on the runner: exec format error)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
This commit is contained in:
1 parent
6c57250ec3
commit
02f3548bd3
2 files changed
+12
-3
No files matched your search
@@ -201,7 +201,13 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
want=$(docker run --rm --platform linux/amd64 --entrypoint php "$REPO@$AMD64" -r 'echo PHP_VERSION;')
|
||||
got=$(docker run --rm --platform linux/arm64 --entrypoint php "$REPO@$ARM64_DIGEST" -r 'echo PHP_VERSION;')
|
||||
# `docker run` of an arm64 image fails on this runner ("exec format error": no binfmt for the
|
||||
# daemon), but BuildKit runs arm64 RUN steps under QEMU (that is how the image was built):
|
||||
# run php in a throwaway build and export just the version file.
|
||||
out=$(mktemp -d); ctx=$(mktemp -d)
|
||||
printf 'FROM %s@%s AS src\nRUN php -r '"'"'echo PHP_VERSION;'"'"' > /pv\nFROM scratch\nCOPY --from=src /pv /pv\n' "$REPO" "$ARM64_DIGEST" |
|
||||
docker buildx build --platform linux/arm64 --output "type=local,dest=$out" -f - "$ctx"
|
||||
got=$(cat "$out/pv")
|
||||
echo "amd64 (existing tag) PHP ${want}; new arm64 PHP ${got}"
|
||||
[[ "$want" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]] || { echo "::error::cannot read the amd64 PHP version"; exit 1; }
|
||||
[ "$want" = "$got" ] || { echo "::error::PHP version differs between the existing amd64 (${want}) and the new arm64 (${got}); not attaching. The amd64 image needs a rebuild first."; exit 1; }
|
||||
|
||||
Reference in new issue
Block a user