Skip to content

Commit 2122428

Browse files
authored
Respect GOARCH value in build-controller-image.sh (#612)
Issue [#2568](aws-controllers-k8s/community#2568) Description of changes: - Fix incorrect usage of non-existent go_arch build arg - Add `--platform` flag based on value of GOARCH By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent b2dc0f4 commit 2122428

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scripts/build-controller-image.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ if [ "$GOARCH" != "arm64" ] && [ "$GOARCH" != "amd64" ]; then
2020
GOARCH="amd64"
2121
fi
2222

23+
DOCKER_PLATFORM_ARG="--platform linux/$GOARCH"
24+
2325
if [[ $QUIET = "false" ]]; then
2426
echo "Using $GOARCH platform."
2527
fi
@@ -112,7 +114,8 @@ if ! docker build \
112114
--build-arg build_date="$BUILD_DATE" \
113115
--build-arg golang_version="${GOLANG_VERSION}" \
114116
--build-arg eks_distro_version="${BASE_IMAGE_VERSION}" \
115-
--build-arg go_arch="$GOARCH" \
117+
--build-arg target_arch="$GOARCH" \
118+
${DOCKER_PLATFORM_ARG} \
116119
--progress plain \
117120
"${DOCKER_BUILD_CONTEXT}"; then
118121
exit 2

0 commit comments

Comments
 (0)