-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathDockerfile-0.12-slim
98 lines (82 loc) · 3.88 KB
/
Dockerfile-0.12-slim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
FROM golang:1.12.6 AS tfmask
RUN git clone https://github.com/cloudposse/tfmask.git
RUN cd tfmask && make && make go/build
FROM debian:buster-slim
ARG TF_VERSIONS="0.12.29"
ARG DEFAULT_TF_VERSION=0.12.29
ARG GCLOUD_VERSION=314.0.0
ARG AWSCLI_VERSION=1.18.134
ARG HELM2_VERSION=2.16.10
ARG HELM3_VERSION=3.3.1
ARG TFSWITCH_VERSION=0.13.1275
ARG TF_AIVEN_VERSIONS="2.0.6"
ARG TF_OVO_VERSIONS="1.0.0 1.1.0 1.9.9"
ARG TF_AIVEN_KAFKA_USERS_VERSIONS="0.0.1 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.0.10 1.1.0 1.1.1 1.1.2 2.0.0 2.1.0 2.1.1 2.2.0"
# Terraform environment variables
ENV CHECKPOINT_DISABLE=true
ENV TF_IN_AUTOMATION=yep
ENV TF_INPUT=false
ENV TF_PLUGIN_CACHE_DIR=/usr/local/share/terraform/plugin-cache
ENV CLOUDSDK_PYTHON=python3
RUN apt-get update && apt-get install --no-install-recommends -y \
ssh \
tar \
gzip \
ca-certificates \
curl \
unzip \
jq \
python3 \
python3-setuptools \
python3-requests \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
RUN curl -fsL https://github.com/warrensbox/terraform-switcher/releases/download/${TFSWITCH_VERSION}/terraform-switcher_${TFSWITCH_VERSION}_linux_amd64.tar.gz -o tfswitch.tar.gz \
&& tar -xvf tfswitch.tar.gz tfswitch \
&& mv tfswitch /usr/local/bin \
&& rm -rf tfswitch.tar.gz \
&& for TF_VERSION in $TF_VERSIONS; do \
tfswitch $TF_VERSION; \
done \
&& tfswitch $DEFAULT_TF_VERSION
RUN mkdir -p $TF_PLUGIN_CACHE_DIR
RUN mkdir -p /root/.terraform.d/plugins \
&& for TF_AIVEN_VERSION in $TF_AIVEN_VERSIONS; do \
curl -f -L "https://github.com/aiven/terraform-provider-aiven/releases/download/v${TF_AIVEN_VERSION}/terraform-provider-aiven_${TF_AIVEN_VERSION}_linux_amd64.zip" -o aiven-provider.zip \
&& unzip aiven-provider.zip terraform-provider-aiven_v${TF_AIVEN_VERSION} -d /root/.terraform.d/plugins \
&& chmod +x /root/.terraform.d/plugins/terraform-provider-aiven_v${TF_AIVEN_VERSION} \
&& rm aiven-provider.zip; \
done
# helm 2
RUN curl -fsL "https://get.helm.sh/helm-v${HELM2_VERSION}-linux-amd64.tar.gz" | tar -xzvf- \
&& mv linux-amd64/helm /usr/local/bin/helm2 \
&& rm -rf helm*.tar.gz linux-amd64/ \
&& ln -s /usr/local/bin/helm2 /usr/local/bin/helm \
&& helm init --stable-repo-url=https://charts.helm.sh/stable --client-only
ENV HELM_HOME /root/.helm
# helm 3
RUN curl -fsL "https://get.helm.sh/helm-v${HELM3_VERSION}-linux-amd64.tar.gz" | tar -xzvf- \
&& mv linux-amd64/helm /usr/local/bin/helm3 \
&& rm -rf helm*.tar.gz linux-amd64/
# ovo provider
RUN mkdir -p /root/.terraform.d/plugins \
&& for TF_OVO_VERSION in $TF_OVO_VERSIONS; do \
curl -f -L https://kafka-users-prod-tf-provider.s3-eu-west-1.amazonaws.com/terraform-provider-ovo/${TF_OVO_VERSION}/terraform-provider-ovo_${TF_OVO_VERSION}_linux_amd64.zip -o ovo.zip \
&& unzip ovo.zip -d /root/.terraform.d/plugins \
&& rm ovo.zip; \
done
# aiven_kafka_users provider
RUN for TF_AIVEN_KAFKA_USERS_VERSION in $TF_AIVEN_KAFKA_USERS_VERSIONS; do \
curl -f -L https://kafka-users-prod-tf-provider.s3-eu-west-1.amazonaws.com/terraform-provider-aiven-kafka-users/${TF_AIVEN_KAFKA_USERS_VERSION}/terraform-provider-aiven-kafka-users_${TF_AIVEN_KAFKA_USERS_VERSION}_linux_amd64.zip -o aiven-kafka-users.zip \
&& unzip aiven-kafka-users.zip -d /root/.terraform.d/plugins \
&& rm aiven-kafka-users.zip; \
done
RUN curl -fsL https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GCLOUD_VERSION}-linux-x86_64.tar.gz -o /opt/google-cloud-sdk.tar.gz \
&& cd /opt; tar -xf google-cloud-sdk.tar.gz \
&& rm google-cloud-sdk.tar.gz
ENV PATH "/opt/google-cloud-sdk/bin:$PATH"
RUN pip3 install --no-cache-dir awscli==$AWSCLI_VERSION
COPY --from=tfmask /go/tfmask/release/tfmask /usr/local/bin/tfmask
ENV TFMASK_RESOURCES_REGEX="(?i)^(random_id|kubernetes_secret|acme_certificate).*$"
COPY compact_plan.py /usr/local/bin/compact_plan
ENTRYPOINT ["/usr/local/bin/terraform"]