Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/build_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pushd ${SCRIPT_DIR} &> /dev/null
export REPO_ROOT=${REPO_ROOT:-"$(git rev-parse --show-toplevel)"}
popd &> /dev/null

HOST_ARCH=$(dpkg --print-architecture)
HOST_ARCH=$(uname -m)
DOCKER_TARGET_ARCH=${DOCKER_TARGET_ARCH:-${HOST_ARCH}}
Comment on lines +24 to 25
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Architecture naming mismatch will break Docker builds on Linux systems.

uname -m returns raw kernel architecture names (x86_64, aarch64) while Docker's --platform flag on line 40 expects normalized names (amd64, arm64). This will cause builds to fail on x86_64 and ARM64 Linux systems with an invalid platform error.

A mapping is needed to translate uname -m output to Docker-compatible architecture names.

🐛 Proposed fix with architecture mapping
-HOST_ARCH=$(uname -m)
+# Map uname output to Docker platform architecture names
+case $(uname -m) in
+    x86_64)  HOST_ARCH="amd64" ;;
+    aarch64) HOST_ARCH="arm64" ;;
+    arm64)   HOST_ARCH="arm64" ;;
+    *)       HOST_ARCH=$(uname -m) ;;
+esac
 DOCKER_TARGET_ARCH=${DOCKER_TARGET_ARCH:-${HOST_ARCH}}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
HOST_ARCH=$(uname -m)
DOCKER_TARGET_ARCH=${DOCKER_TARGET_ARCH:-${HOST_ARCH}}
# Map uname output to Docker platform architecture names
case $(uname -m) in
x86_64) HOST_ARCH="amd64" ;;
aarch64) HOST_ARCH="arm64" ;;
arm64) HOST_ARCH="arm64" ;;
*) HOST_ARCH=$(uname -m) ;;
esac
DOCKER_TARGET_ARCH=${DOCKER_TARGET_ARCH:-${HOST_ARCH}}
🤖 Prompt for AI Agents
In `@docker/build_container.sh` around lines 24 - 25, The script sets HOST_ARCH
from uname -m and uses DOCKER_TARGET_ARCH from it, but Docker --platform
requires normalized names; update the assignment logic for
HOST_ARCH/DOCKER_TARGET_ARCH to map raw uname -m outputs to Docker-compatible
values (e.g., map x86_64 -> amd64, aarch64 -> arm64, arm64 -> arm64, i386 ->
386, armv7l -> arm/v7, etc.) so the --platform flag (used later) receives a
valid architecture; implement a small mapping block that reads HOST_ARCH=$(uname
-m) and then sets DOCKER_TARGET_ARCH=${DOCKER_TARGET_ARCH:-<mapped-value>} based
on those cases.


if [ ${DOCKER_TARGET_ARCH} != ${HOST_ARCH} ]; then
Expand Down