-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-dev
40 lines (34 loc) · 2.43 KB
/
Dockerfile-dev
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
FROM alpine:3.18.4
# Use ARG so that values can be overriden by user/cloudbuild
ARG TERRAFORM_VERSION=1.5.7
ARG GCLOUD_VERSION=455.0.0
ENV ENV_TERRAFORM_VERSION=$TERRAFORM_VERSION
ENV ENV_GCLOUD_VERSION=$GCLOUD_VERSION
WORKDIR /home
RUN mkdir /usr/local/gcloud /usr/local/terraform
RUN if [ "$(uname -m)" = "x86_64" ]; then \
export ARCH=amd64; \
export ARCH_GCLOUD=x86_64; \
elif [ "$(uname -m)" = "aarch64" ]; then \
export ARCH=arm64; \
export ARCH_GCLOUD=arm; \
else \
export ARCH=unknown; \
fi && \
echo "ARCH=$ARCH" >> /etc/environment && \
apk add --no-cache bash curl jq unzip git ca-certificates gnupg python3 && \
curl https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-${ENV_GCLOUD_VERSION}-linux-${ARCH_GCLOUD}.tar.gz --output /tmp/google-cloud-cli-${ENV_GCLOUD_VERSION}-linux-${ARCH_GCLOUD}.tar.gz &&\
curl https://releases.hashicorp.com/terraform/${ENV_TERRAFORM_VERSION}/terraform_${ENV_TERRAFORM_VERSION}_linux_${ARCH}.zip --output /tmp/terraform_${ENV_TERRAFORM_VERSION}_linux_${ARCH}.zip && \
curl https://releases.hashicorp.com/terraform/${ENV_TERRAFORM_VERSION}/terraform_${ENV_TERRAFORM_VERSION}_SHA256SUMS.sig --output /tmp/terraform_SHA256SUMS.sig && \
curl https://releases.hashicorp.com/terraform/${ENV_TERRAFORM_VERSION}/terraform_${ENV_TERRAFORM_VERSION}_SHA256SUMS --output /tmp/terraform_SHA256SUMS && \
curl https://keybase.io/hashicorp/pgp_keys.asc --output /tmp/pgp_keys.asc && \
gpg --import /tmp/pgp_keys.asc && \
gpg --verify /tmp/terraform_SHA256SUMS.sig /tmp/terraform_SHA256SUMS && \
grep terraform_${ENV_TERRAFORM_VERSION}_linux_${ARCH}.zip /tmp/terraform_SHA256SUMS | awk '{print $1}' | sha256sum /tmp/terraform_${ENV_TERRAFORM_VERSION}_linux_${ARCH}.zip && \
unzip /tmp/terraform_${ENV_TERRAFORM_VERSION}_linux_${ARCH}.zip -d /usr/local/terraform && \
tar -C /usr/local/gcloud -xzvf /tmp/google-cloud-cli-${ENV_GCLOUD_VERSION}-linux-${ARCH_GCLOUD}.tar.gz && \
rm -f /tmp/terraform_${ENV_TERRAFORM_VERSION}_linux_${ARCH}.zip /tmp/terraform_SHA256SUMS /tmp/google-cloud-cli-${ENV_GCLOUD_VERSION}-linux-${ARCH_GCLOUD}.tar.gz && \
/usr/local/gcloud/google-cloud-sdk/install.sh --path-update true --quiet && \
/usr/local/gcloud/google-cloud-sdk/bin/gcloud -q components install alpha beta terraform-tools
ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin:/usr/local/terraform
ENTRYPOINT ["terraform"]