Skip to content

Commit

Permalink
Auto-detect arm platform in build.sh & rebuild.sh
Browse files Browse the repository at this point in the history
From #355
  • Loading branch information
pgleeson committed Oct 28, 2024
1 parent 9b7c146 commit 9d678be
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 11 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
#!/bin/bash

version=$(<VERSION) # Read version of Dockerfile from file VERSION
docker build "$@" -t "openworm/openworm:$version" .

# Set the platform flag if we're on ARM
arch=$(uname -m)
if [[ "$arch" == "arm64" || "$arch" == "aarch64" ]]; then
platform_flag="--platform linux/amd64"
else
platform_flag=""
fi

# Build the Docker image
docker build $platform_flag "$@" -t "openworm/openworm:$version" .
12 changes: 11 additions & 1 deletion rebuild.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
#!/bin/bash

version=$(<VERSION) # Read version of Dockerfile from file VERSION
docker build "$@" -t "openworm/openworm:$version" --no-cache .

# Set the platform flag if we're on ARM
arch=$(uname -m)
if [[ "$arch" == "arm64" || "$arch" == "aarch64" ]]; then
platform_flag="--platform linux/amd64"
else
platform_flag=""
fi

# Rebuild the Docker image
docker build $platform_flag "$@" -t "openworm/openworm:$version" --no-cache .

0 comments on commit 9d678be

Please sign in to comment.