- New custom CI Docker image (ci/Dockerfile) with TF 1.5.7, TG 0.99.4, git-crypt, sops, kubectl pre-installed. Pushed to private registry. Eliminates 17 apk add calls + binary downloads per pipeline run. - Unified CI pipeline: merge default.yml + app-stacks.yml into one. Changed-stacks-only detection (git diff, with global-file fallback). Concurrency limit (xargs -P 4). Step consolidation (2 steps vs 4). Shallow clone (depth=2). Provider cache (TF_PLUGIN_CACHE_DIR). - Per-stack Vault advisory locks in scripts/tg. 30min TTL with stale lock detection. Blocks concurrent applies to same stack. - TF_PLUGIN_CACHE_DIR enabled by default in scripts/tg for local dev. - Daily drift detection pipeline (.woodpecker/drift-detection.yml). Runs terraform plan on all stacks, Slack alert on drift. - CI image build pipeline (.woodpecker/build-ci-image.yml). Expected speedup: ~5-10 min per pipeline run → ~2-4 min. [ci skip] Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
42 lines
1.4 KiB
Docker
42 lines
1.4 KiB
Docker
FROM alpine:3.20
|
|
|
|
# Pin versions to match CI requirements
|
|
ARG TERRAFORM_VERSION=1.5.7
|
|
ARG TERRAGRUNT_VERSION=0.99.4
|
|
ARG SOPS_VERSION=3.9.4
|
|
ARG KUBECTL_VERSION=1.34.0
|
|
|
|
# Install system packages (single layer)
|
|
RUN apk add --no-cache \
|
|
bash curl git git-crypt jq openssh-client openssl unzip \
|
|
&& rm -rf /var/cache/apk/*
|
|
|
|
# Terraform
|
|
RUN curl -fsSL "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 \
|
|
&& terraform version
|
|
|
|
# Terragrunt
|
|
RUN curl -fsSL "https://github.com/gruntwork-io/terragrunt/releases/download/v${TERRAGRUNT_VERSION}/terragrunt_linux_amd64" \
|
|
-o /usr/local/bin/terragrunt \
|
|
&& chmod +x /usr/local/bin/terragrunt \
|
|
&& terragrunt --version
|
|
|
|
# SOPS (for state encryption)
|
|
RUN curl -fsSL "https://github.com/getsops/sops/releases/download/v${SOPS_VERSION}/sops-v${SOPS_VERSION}.linux.amd64" \
|
|
-o /usr/local/bin/sops \
|
|
&& chmod +x /usr/local/bin/sops
|
|
|
|
# kubectl
|
|
RUN curl -fsSL "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" \
|
|
-o /usr/local/bin/kubectl \
|
|
&& chmod +x /usr/local/bin/kubectl
|
|
|
|
# Provider cache directory (shared across stacks)
|
|
ENV TF_PLUGIN_CACHE_DIR=/tmp/terraform-plugin-cache
|
|
ENV TF_PLUGIN_CACHE_MAY_BREAK_DEPENDENCY_LOCK_FILE=1
|
|
RUN mkdir -p /tmp/terraform-plugin-cache
|
|
|
|
WORKDIR /workspace
|