From bbbd3364a6b39c0bdc1840911f194b8b17b8bb1d Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Sun, 7 Dec 2025 17:52:27 +0000 Subject: [PATCH] refactor: use alpine base for lighter image --- images/terraform-ci/Dockerfile | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/images/terraform-ci/Dockerfile b/images/terraform-ci/Dockerfile index 7b3d345..c055ef0 100644 --- a/images/terraform-ci/Dockerfile +++ b/images/terraform-ci/Dockerfile @@ -1,33 +1,46 @@ # ============================================================================= # 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 # ============================================================================= -FROM hashicorp/terraform:1.5.7 +FROM alpine:3.20 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 \ curl \ git \ 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 -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 \ && unzip /tmp/tflint.zip -d /usr/local/bin \ && rm /tmp/tflint.zip \ && chmod +x /usr/local/bin/tflint +# Nettoyage pour réduire la taille +RUN rm -rf /var/cache/apk/* /tmp/* + # Vérification des versions RUN terraform version && tflint --version WORKDIR /workspace -ENTRYPOINT [] CMD ["/bin/bash"]