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.
This commit is contained in:
Cian Johnston 2023-09-08 11:47:51 +01:00 committed by GitHub
parent 8d7eb1728c
commit a3a16a1586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 5 deletions

View File

@ -25,13 +25,11 @@ RUN apk add --no-cache \
# Terraform was disabled in the edge repo due to a build issue.
# https://gitlab.alpinelinux.org/alpine/aports/-/commit/f3e263d94cfac02d594bef83790c280e045eba35
# Using wget for now. Note that busybox unzip doesn't support streaming.
ARG ARCH
RUN wget -O /tmp/terraform.zip "https://releases.hashicorp.com/terraform/1.5.6/terraform_1.5.6_linux_${ARCH}.zip" && \
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" && \
busybox unzip /tmp/terraform.zip -d /usr/local/bin && \
rm -f /tmp/terraform.zip && \
chmod +x /usr/local/bin/terraform && \
terraform --version
USER 1000:1000
ENV HOME=/home/coder
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt

View File

@ -103,7 +103,6 @@ declare -A arch_map=(
[arm]="linux/arm/v7"
[armv7]="linux/arm/v7"
)
orig_arch="$arch"
if [[ "${arch_map[$arch]+exists}" != "" ]]; then
arch="${arch_map[$arch]}"
fi
@ -125,7 +124,6 @@ if [[ "$build_base" != "" ]]; then
log "--- Building base Docker image for $arch ($build_base)"
docker build \
--platform "$arch" \
--build-arg "ARCH=${orig_arch}" \
--tag "$build_base" \
--no-cache \
-f Dockerfile.base \