Skip to content

Commit 259750b

Browse files
authored
Merge pull request #355 from tijszwinkels/detect-arm
auto-detect arm platform in build.sh
2 parents 0f68b03 + e29a775 commit 259750b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

build.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
#!/bin/bash
22

3-
version=$(<VERSION) # Read version of Dockerfile from file VERSION
4-
docker build "$@" -t "openworm/openworm:$version" .
3+
version=$(<VERSION)
4+
5+
# Set the platform flag if we're on ARM
6+
arch=$(uname -m)
7+
if [[ "$arch" == "arm64" || "$arch" == "aarch64" ]]; then
8+
platform_flag="--platform linux/amd64"
9+
else
10+
platform_flag=""
11+
fi
12+
13+
# Build the Docker image
14+
docker build $platform_flag "$@" -t "openworm/openworm:$version" .

0 commit comments

Comments
 (0)