Skip to content

Commit a3a16a1

Browse files
authored
fix(scripts): modify logic for determining terraform arch (#9595)
Commit fb3616c used a build-arg to set the desired terrafomr architeture to fetch. This is set in build_docker.sh but not when building using depot.dev. Baking the logic into the Dockerfile instead.
1 parent 8d7eb17 commit a3a16a1

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

scripts/Dockerfile.base

+1-3
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ RUN apk add --no-cache \
2525
# Terraform was disabled in the edge repo due to a build issue.
2626
# https://gitlab.alpinelinux.org/alpine/aports/-/commit/f3e263d94cfac02d594bef83790c280e045eba35
2727
# Using wget for now. Note that busybox unzip doesn't support streaming.
28-
ARG ARCH
29-
RUN wget -O /tmp/terraform.zip "https://releases.hashicorp.com/terraform/1.5.6/terraform_1.5.6_linux_${ARCH}.zip" && \
28+
RUN ARCH="$(arch)"; if [ "${ARCH}" == "x86_64" ]; then ARCH="amd64"; fi; wget -O /tmp/terraform.zip "https://releases.hashicorp.com/terraform/1.5.6/terraform_1.5.6_linux_${ARCH}.zip" && \
3029
busybox unzip /tmp/terraform.zip -d /usr/local/bin && \
3130
rm -f /tmp/terraform.zip && \
3231
chmod +x /usr/local/bin/terraform && \
3332
terraform --version
34-
3533
USER 1000:1000
3634
ENV HOME=/home/coder
3735
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt

scripts/build_docker.sh

-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ declare -A arch_map=(
103103
[arm]="linux/arm/v7"
104104
[armv7]="linux/arm/v7"
105105
)
106-
orig_arch="$arch"
107106
if [[ "${arch_map[$arch]+exists}" != "" ]]; then
108107
arch="${arch_map[$arch]}"
109108
fi
@@ -125,7 +124,6 @@ if [[ "$build_base" != "" ]]; then
125124
log "--- Building base Docker image for $arch ($build_base)"
126125
docker build \
127126
--platform "$arch" \
128-
--build-arg "ARCH=${orig_arch}" \
129127
--tag "$build_base" \
130128
--no-cache \
131129
-f Dockerfile.base \

0 commit comments

Comments
 (0)