From e88073fa96b72945949fd3ff57f32dab9f5bc565 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Fri, 8 Sep 2023 10:33:43 +0100 Subject: [PATCH 1/3] wget terraform directly from releases.hashicorp.com --- scripts/Dockerfile.base | 13 ++++++++++--- scripts/build_docker.sh | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/Dockerfile.base b/scripts/Dockerfile.base index 2681ef9cafec2..1712fdd7342ed 100644 --- a/scripts/Dockerfile.base +++ b/scripts/Dockerfile.base @@ -12,9 +12,6 @@ RUN apk add --no-cache \ bash \ git \ 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 \ -g 1000 \ coder && \ @@ -25,6 +22,16 @@ RUN apk add --no-cache \ -u 1000 \ -G 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 / && \ + mv /terraform /usr/local/bin/terraform && \ + rm -f /tmp/terraform.zip && \ + chmod +x /usr/local/bin/terraform && \ + terraform --version USER 1000:1000 ENV HOME=/home/coder diff --git a/scripts/build_docker.sh b/scripts/build_docker.sh index 1bee954e9713c..32a42d77a9ded 100755 --- a/scripts/build_docker.sh +++ b/scripts/build_docker.sh @@ -103,6 +103,7 @@ 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 @@ -124,6 +125,7 @@ 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 \ From d5ba23ea3818f69adc89eb22e618cc077b34a2df Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Fri, 8 Sep 2023 10:40:44 +0100 Subject: [PATCH 2/3] fixup! wget terraform directly from releases.hashicorp.com --- scripts/Dockerfile.base | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/Dockerfile.base b/scripts/Dockerfile.base index 1712fdd7342ed..80fc9a8c41d70 100644 --- a/scripts/Dockerfile.base +++ b/scripts/Dockerfile.base @@ -27,8 +27,7 @@ RUN apk add --no-cache \ # 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 / && \ - mv /terraform /usr/local/bin/terraform && \ + busybox unzip /tmp/terraform.zip -d /usr/local/bin && \ rm -f /tmp/terraform.zip && \ chmod +x /usr/local/bin/terraform && \ terraform --version From 173d7b0fea380cbdf1b403a1753eda0287b7d14e Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Fri, 8 Sep 2023 10:51:31 +0100 Subject: [PATCH 3/3] fixup! wget terraform directly from releases.hashicorp.com --- scripts/build_docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build_docker.sh b/scripts/build_docker.sh index 32a42d77a9ded..af3ff6a21e711 100755 --- a/scripts/build_docker.sh +++ b/scripts/build_docker.sh @@ -125,7 +125,7 @@ if [[ "$build_base" != "" ]]; then log "--- Building base Docker image for $arch ($build_base)" docker build \ --platform "$arch" \ - --build-arg "ARCH=$orig_arch" \ + --build-arg "ARCH=${orig_arch}" \ --tag "$build_base" \ --no-cache \ -f Dockerfile.base \