-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
62 lines (45 loc) · 1.93 KB
/
Dockerfile
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
# Base image containing dependencies used in builder and final image
FROM ghcr.io/swissgrc/azure-pipelines-azurecli:2.65.0-net8 AS base
# Builder image
FROM base AS build
# Make sure to fail due to an error at any stage in shell pipes
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# renovate: datasource=repology depName=debian_12/unzip versioning=deb
ENV UNZIP_VERSION=6.0
# Install necessary dependencies
RUN apt-get update -y && \
apt-get install -y --no-install-recommends unzip=${UNZIP_VERSION}-28
# Install Terraform
# renovate: datasource=github-releases depName=hashicorp/terraform extractVersion=^v(?<version>.*)$
ENV TERRAFORM_VERSION=1.9.8
# Download Terraform
ADD https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip /tmp/terraform.zip
RUN unzip /tmp/terraform.zip -d /tmp && \
rm /tmp/terraform.zip
# Install tflint
# renovate: datasource=github-releases depName=terraform-linters/tflint extractVersion=^v(?<version>.*)$
ENV TFLINT_VERSION=0.54.0
ADD https://github.com/terraform-linters/tflint/releases/download/v${TFLINT_VERSION}/tflint_linux_amd64.zip /tmp/tflint.zip
RUN unzip /tmp/tflint.zip -d /tmp && \
rm /tmp/tflint.zip
# Final image
FROM base AS final
LABEL org.opencontainers.image.vendor="Swiss GRC AG"
LABEL org.opencontainers.image.authors="Swiss GRC AG <opensource@swissgrc.com>"
LABEL org.opencontainers.image.title="azure-pipelines-terraform"
LABEL org.opencontainers.image.documentation="https://github.com/swissgrc/docker-azure-pipelines-terraform"
# Make sure to fail due to an error at any stage in shell pipes
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
WORKDIR /
COPY --from=build /tmp/ /tmp
RUN \
# Ensure prerequisits are available
git version && \
# Install Terraform
cp /tmp/terraform /usr/bin/terraform && \
terraform version && \
# Install tflint
cp /tmp/tflint /usr/local/bin/tflint && \
tflint --version && \
# Cleanup
rm -rf /tmp/*