Skip to content

Commit 9d678be

Browse files
committed
Auto-detect arm platform in build.sh & rebuild.sh
From #355
1 parent 9b7c146 commit 9d678be

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

build.sh

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

33
version=$(<VERSION) # Read version of Dockerfile from file VERSION
4-
docker build "$@" -t "openworm/openworm:$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" .

rebuild.sh

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

33
version=$(<VERSION) # Read version of Dockerfile from file VERSION
4-
docker build "$@" -t "openworm/openworm:$version" --no-cache .
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+
# Rebuild the Docker image
14+
docker build $platform_flag "$@" -t "openworm/openworm:$version" --no-cache .

0 commit comments

Comments
 (0)