Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions scripts/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand All @@ -25,6 +22,15 @@ 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It used to 😢

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 && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it already is +x inside the zip, but caution doesn't hurt here.

terraform --version

USER 1000:1000
ENV HOME=/home/coder
Expand Down
2 changes: 2 additions & 0 deletions scripts/build_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand Down