refactor: use alpine base for lighter image
Some checks failed
Build and Push Docker Images / detect-changes (push) Failing after 7s
Build and Push Docker Images / build (push) Has been skipped

This commit is contained in:
2025-12-07 17:52:27 +00:00
parent 067fb69c8f
commit bbbd3364a6

View File

@@ -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"]