fix(scripts): wget terraform directly from releases.hashicorp.com (#9594)

This commit is contained in:
Cian Johnston
2023-09-08 11:02:18 +01:00
committed by GitHub
parent 11b6068112
commit fb3616c37e
2 changed files with 11 additions and 3 deletions

View File

@ -12,9 +12,6 @@ RUN apk add --no-cache \
bash \ bash \
git \ git \
openssh-client && \ openssh-client && \
# Use the edge repo, since Terraform doesn't seem to be backported to 3.18.
apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \
terraform=~1.5 && \
addgroup \ addgroup \
-g 1000 \ -g 1000 \
coder && \ coder && \
@ -25,6 +22,15 @@ RUN apk add --no-cache \
-u 1000 \ -u 1000 \
-G coder \ -G coder \
coder coder
# 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" && \
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 USER 1000:1000
ENV HOME=/home/coder ENV HOME=/home/coder

View File

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