Skip to content

fix: install terraform in base Docker image #6263

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 4 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
remove providers
  • Loading branch information
johnstcn committed Feb 21, 2023
commit e4a1ab88557424f3204679a33a5b051cdaaafeac
1 change: 1 addition & 0 deletions provisioner/terraform/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
var (
// TerraformVersion is the version of Terraform used internally
// when Terraform is not available on the system.
// NOTE: Keep this in sync with the version in scripts/Dockerfile.base.
TerraformVersion = version.Must(version.NewVersion("1.3.4"))

minTerraformVersion = version.Must(version.NewVersion("1.1.0"))
Expand Down
21 changes: 2 additions & 19 deletions scripts/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
FROM alpine:latest

# We use a single RUN command to reduce the number of layers in the image.
# NOTE: Keep the Terraform version in sync with minTerraformVersion and
# maxTerraformVersion in provisioner/terraform/install.go.
RUN apk add --no-cache \
curl \
wget \
Expand All @@ -22,25 +24,6 @@ RUN apk add --no-cache \
-G coder \
coder

# Install Terraform plugins
RUN mkdir -p /opt/terraform/plugins/registry.terraform.io
# Add config for local terraform
ADD files/terraform-config.tfrc /opt/terraform/config.tfrc
ARG CODER_PROVIDER_VERSION=0.6.12
RUN mkdir -p /opt/terraform/plugins/registry.terraform.io/coder/coder
WORKDIR /opt/terraform/plugins/registry.terraform.io/coder/coder
RUN curl -LOs https://github.com/coder/terraform-provider-coder/releases/download/v${CODER_PROVIDER_VERSION}/terraform-provider-coder_${CODER_PROVIDER_VERSION}_linux_amd64.zip
ARG DOCKER_PROVIDER_VERSION=3.0.1
RUN mkdir -p /opt/terraform/plugins/registry.terraform.io/kreuzwerker/docker
WORKDIR /opt/terraform/plugins/registry.terraform.io/kreuzwerker/docker
RUN curl -LOs https://github.com/kreuzwerker/terraform-provider-docker/releases/download/v${DOCKER_PROVIDER_VERSION}/terraform-provider-docker_${DOCKER_PROVIDER_VERSION}_linux_amd64.zip
RUN chown -R coder:coder /opt/terraform/plugins
ARG KUBERNETES_PROVIDER_VERSION=2.18.0
RUN mkdir -p /opt/terraform/plugins/registry.terraform.io/hashicorp/kubernetes
WORKDIR /opt/terraform/plugins/registry.terraform.io/hashicorp/kubernetes
# TODO: What is the URL?
RUN curl -LOs $KUBERNETES_URL_GOES_HERE

USER 1000:1000
ENV HOME=/home/coder
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt
Expand Down