-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.old
28 lines (25 loc) · 1.08 KB
/
Dockerfile.old
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#syntax=docker/dockerfile:1.4
FROM alpine:3.16
RUN apk add bash curl gettext jq lz4 helm kubectl zstd --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community --no-cache
RUN curl -L0 https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_linux_amd64.zip > tf.zip && unzip tf.zip && mv terraform /usr/local/bin && rm tf.zip
WORKDIR /app
COPY --chown=nonroot ./terraform ./terraform
RUN mkdir -p infrastructure-templates
COPY --chown=nonroot ./infrastructure-templates ./infrastructure-templates
ENV TF_PLUGIN_CACHE_DIR="/app/.terraform.d/plugin-cache"
# COPY .terraform.d.zip /app/terraform.zip
RUN mkdir -p $TF_PLUGIN_CACHE_DIR
SHELL ["/bin/bash", "-c"]
RUN <<'EOF'
for dir in $(ls -d ./infrastructure-templates/{aws,gcp}/*); do
pushd $dir
terraform init -backend=false &
popd
done
wait
tdir=$(basename $(dirname $TF_PLUGIN_CACHE_DIR))
tar cf - $tdir | zstd --compress > tf.zst && rm -rf $tdir
EOF
# ENV DECOMPRESS_CMD="lz4 -d tf.lz4 | tar xf -"
ENV DECOMPRESS_CMD="zstd --decompress tf.zst --stdout | tar xf -"
ENV TEMPLATES_DIR="/app/infrastructure-templates"