terraform-contour-mirror/Dockerfile

35 lines
1.4 KiB
Docker

FROM alpine:latest
RUN apk add --no-cache curl unzip bash git
ARG TERRAFORM_VERSION=1.5.7
RUN curl -fsSL https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -o terraform.zip && \
unzip terraform.zip -d /usr/local/bin/ && \
chmod +x /usr/local/bin/terraform && \
rm -f terraform.zip
ARG TERRAGRUNT_VERSION=0.93.11
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
# Create plugin cache directory - Terraform will download providers here from Yandex mirror
RUN mkdir -p /root/.terraform.d/plugin-cache
# Configure Terraform to use Yandex Terraform registry mirror
RUN mkdir -p /root/.terraform.d && \
echo 'provider_installation {' > /root/.terraformrc && \
echo ' network_mirror {' >> /root/.terraformrc && \
echo ' url = "https://terraform-mirror.yandexcloud.net/"' >> /root/.terraformrc && \
echo ' include = ["registry.terraform.io/*/*"]' >> /root/.terraformrc && \
echo ' }' >> /root/.terraformrc && \
echo ' direct {' >> /root/.terraformrc && \
echo ' exclude = ["registry.terraform.io/*/*"]' >> /root/.terraformrc && \
echo ' }' >> /root/.terraformrc && \
echo '}' >> /root/.terraformrc
ENV TF_PLUGIN_CACHE_DIR=/root/.terraform.d/plugin-cache
ENV TG_TF_PATH=/usr/local/bin/terraform
WORKDIR /workspace