Skip to content

Instantly share code, notes, and snippets.

@CodeMonkeyKevin
Last active January 12, 2020 23:22
Show Gist options
  • Save CodeMonkeyKevin/20914caabf7de8318e01d33d7219f7c5 to your computer and use it in GitHub Desktop.
Save CodeMonkeyKevin/20914caabf7de8318e01d33d7219f7c5 to your computer and use it in GitHub Desktop.
Terraform docker runner
FROM golang:alpine
MAINTAINER "HashiCorp Terraform Team <terraform@hashicorp.com>"
ENV TERRAFORM_VERSION=0.12.19
RUN apk add --update git bash openssh make curl nodejs yarn
# Set timezone to UTC by default
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime
ENV TF_DEV=true
ENV TF_RELEASE=true
WORKDIR $GOPATH/src/github.com/hashicorp/terraform
RUN git clone https://github.com/hashicorp/terraform.git ./ && \
git checkout v${TERRAFORM_VERSION} && \
/bin/bash scripts/build.sh
# Install aws-cli
RUN apk -Uuv add groff less python py-pip
RUN pip install awscli
RUN apk --purge -v del py-pip
RUN rm /var/cache/apk/*
WORKDIR $GOPATH
ENTRYPOINT ["terraform"]
## Build Image with Tag
# docker build -t tf-runner .
## Run image and mount volume to ~/
# docker run -t -i -v ./profile:/root tf-runner plan main.tf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment