Skip to content

Commit 17e4554

Browse files
add test script for arm docker build
1 parent cbe05e4 commit 17e4554

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

docker/test/test-arm-build.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# register QEMU handlers for emulation (one-time)
5+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
6+
7+
# create and use a buildx builder (if you don't already have one)
8+
if ! docker buildx inspect mybuilder > /dev/null 2>&1; then
9+
docker buildx create --name mybuilder --use
10+
else
11+
docker buildx use mybuilder
12+
fi
13+
docker buildx inspect --bootstrap
14+
15+
# change to repo root
16+
cd ../..
17+
18+
# build the alpine image for arm64 and amd64
19+
# Note: We cannot use --load with multiple platforms.
20+
# We will build for arm64 specifically to test the emulation and load it.
21+
echo "Building for linux/arm64..."
22+
docker buildx build --platform linux/arm64 -f Dockerfile.alpine -t local-speedtest:alpine-arm64 --load .
23+
24+
# To build for both platforms, you typically need to push to a registry:
25+
# docker buildx build --platform linux/amd64,linux/arm64 -f Dockerfile.alpine -t local-speedtest:alpine --push .

0 commit comments

Comments
 (0)