Skip to content

Commit

Permalink
Make platform dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydrogers committed Oct 7, 2024
1 parent 7a83041 commit 153b828
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ build_docker_image() {

# Set default platform if not specified
if [ -z "$PLATFORM" ]; then
PLATFORM="linux/amd64"
PLATFORM=$(detect_platform)
fi

# Add platform to build args
Expand Down Expand Up @@ -119,6 +119,22 @@ check_vars() {
return 0
}

detect_platform() {
local arch=$(uname -m)
case $arch in
x86_64)
echo "linux/amd64"
;;
arm64|aarch64)
echo "linux/arm64/v8"
;;
*)
echo "Unsupported architecture: $arch" >&2
exit 1
;;
esac
}

echo_color_message (){
color=$1
message=$2
Expand Down

0 comments on commit 153b828

Please sign in to comment.