Skip to content

Commit 5d7d235

Browse files
committed
refactor: clarify architecture and platform determination
1 parent d3cfabe commit 5d7d235

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

tools/container-build.sh

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,25 @@ fi
1515
COMMIT_ID="$(git rev-parse --short=8 HEAD)"
1616
VERSION="${GO_VERSION}.$(date +%s)"
1717

18-
# Detect architecture to build for (allow override via DOCKER_DEFAULT_PLATFORM)
18+
# Determine what architecture to build for
1919
if [ -n "${DOCKER_DEFAULT_PLATFORM}" ]; then
20+
# User specified a platform override
2021
PLATFORM="${DOCKER_DEFAULT_PLATFORM}"
2122
else
22-
case "$(uname -m)" in
23-
"x86_64") PLATFORM="linux/amd64" ;;
24-
"aarch64"|"arm64") PLATFORM="linux/arm64" ;;
25-
*) echo "Unsupported architecture: $(uname -m)" && exit 1 ;;
23+
# No override - detect from current machine
24+
MACHINE_ARCH=$(uname -m)
25+
case "${MACHINE_ARCH}" in
26+
x86_64) PLATFORM="linux/amd64" ;;
27+
aarch64) PLATFORM="linux/arm64" ;;
28+
arm64) PLATFORM="linux/arm64" ;;
29+
*) echo "Unsupported machine architecture: ${MACHINE_ARCH}" && exit 1 ;;
2630
esac
2731
fi
2832

29-
# Extract architecture from platform
30-
case "$PLATFORM" in
31-
"linux/amd64") ARCH="amd64" ;;
32-
"linux/arm64") ARCH="arm64" ;;
33+
# Convert platform to short architecture name for file naming
34+
case "${PLATFORM}" in
35+
linux/amd64) ARCH="amd64" ;;
36+
linux/arm64) ARCH="arm64" ;;
3337
*) echo "Unsupported platform: ${PLATFORM}" && exit 1 ;;
3438
esac
3539

@@ -45,6 +49,7 @@ docker buildx build \
4549
--build-arg "VERSION=${VERSION}" \
4650
--tag "${TAG}" \
4751
--load \
52+
--progress=plain \
4853
.
4954

5055
# Create tarball

0 commit comments

Comments
 (0)