refactor: use alpine base for lighter image
This commit is contained in:
@@ -1,33 +1,46 @@
|
|||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Terraform CI Image
|
# Terraform CI Image
|
||||||
#
|
#
|
||||||
# Image légère pour les pipelines CI/CD Terraform
|
# Image minimale Alpine pour les pipelines CI/CD Terraform
|
||||||
# Inclut : Terraform, tflint, git
|
# Inclut : Terraform, tflint, git
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
FROM hashicorp/terraform:1.5.7
|
FROM alpine:3.20
|
||||||
|
|
||||||
LABEL maintainer="Damien Arnodo"
|
LABEL maintainer="Damien Arnodo"
|
||||||
LABEL description="Terraform CI image with tflint for Gitea Actions"
|
LABEL description="Lightweight Terraform CI image with tflint for Gitea Actions"
|
||||||
|
|
||||||
# Installation des outils supplémentaires
|
# Versions des outils
|
||||||
|
ARG TERRAFORM_VERSION=1.5.7
|
||||||
|
ARG TFLINT_VERSION=0.54.0
|
||||||
|
|
||||||
|
# Installation des dépendances de base
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
curl \
|
curl \
|
||||||
git \
|
git \
|
||||||
bash \
|
bash \
|
||||||
jq
|
jq \
|
||||||
|
unzip \
|
||||||
|
ca-certificates
|
||||||
|
|
||||||
|
# Installation de Terraform
|
||||||
|
RUN curl -sL "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" -o /tmp/terraform.zip \
|
||||||
|
&& unzip /tmp/terraform.zip -d /usr/local/bin \
|
||||||
|
&& rm /tmp/terraform.zip \
|
||||||
|
&& chmod +x /usr/local/bin/terraform
|
||||||
|
|
||||||
# Installation de tflint
|
# Installation de tflint
|
||||||
ARG TFLINT_VERSION=0.54.0
|
|
||||||
RUN curl -sL "https://github.com/terraform-linters/tflint/releases/download/v${TFLINT_VERSION}/tflint_linux_amd64.zip" -o /tmp/tflint.zip \
|
RUN curl -sL "https://github.com/terraform-linters/tflint/releases/download/v${TFLINT_VERSION}/tflint_linux_amd64.zip" -o /tmp/tflint.zip \
|
||||||
&& unzip /tmp/tflint.zip -d /usr/local/bin \
|
&& unzip /tmp/tflint.zip -d /usr/local/bin \
|
||||||
&& rm /tmp/tflint.zip \
|
&& rm /tmp/tflint.zip \
|
||||||
&& chmod +x /usr/local/bin/tflint
|
&& chmod +x /usr/local/bin/tflint
|
||||||
|
|
||||||
|
# Nettoyage pour réduire la taille
|
||||||
|
RUN rm -rf /var/cache/apk/* /tmp/*
|
||||||
|
|
||||||
# Vérification des versions
|
# Vérification des versions
|
||||||
RUN terraform version && tflint --version
|
RUN terraform version && tflint --version
|
||||||
|
|
||||||
WORKDIR /workspace
|
WORKDIR /workspace
|
||||||
|
|
||||||
ENTRYPOINT []
|
|
||||||
CMD ["/bin/bash"]
|
CMD ["/bin/bash"]
|
||||||
|
|||||||
Reference in New Issue
Block a user