Skip to content

Commit b3c6b25

Browse files
committed
Move common setup into base image
1 parent 71e3b79 commit b3c6b25

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

image/Dockerfile

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@ ARG TARGETARCH
55
ARG FETCH_CHECKSUMS
66
ARG VERSION=99.0.0
77

8-
RUN gpg --recv-keys C874011F0AB405110D02105534365D9472D7468F \
9-
&& echo "C874011F0AB405110D02105534365D9472D7468F:6:" | gpg --import-ownertrust
10-
11-
RUN curl https://get.opentofu.org/opentofu.gpg | gpg --import \
12-
&& echo "E3E6E43D84CB852EADB0051D0C0AF313E5FD9F80:6:" | gpg --import-ownertrust
13-
14-
RUN gpg --check-trustdb
15-
168
COPY src/ /tmp/src/
179
COPY setup.py /tmp
1810
RUN sed -i "s|version='.*'|version=\'${VERSION}\'|" /tmp/setup.py \
@@ -45,10 +37,6 @@ COPY tools/compact_plan.py /usr/local/bin/compact_plan
4537
COPY tools/format_tf_credentials.py /usr/local/bin/format_tf_credentials
4638
COPY tools/github_comment_react.py /usr/local/bin/github_comment_react
4739

48-
RUN echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config \
49-
&& echo "IdentityFile /.ssh/id_rsa" >> /etc/ssh/ssh_config \
50-
&& mkdir -p /.ssh
51-
5240
COPY tools/http_credential_actions_helper.py /usr/bin/git-credential-actions
5341
RUN git config --system credential.helper /usr/bin/git-credential-actions \
5442
&& git config --system credential.useHttpPath true \

image/Dockerfile-base

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@ RUN git clone https://github.com/cloudposse/tfmask.git \
66
&& make \
77
&& make go/build
88

9-
FROM debian:bullseye-slim as base
9+
FROM debian:bullseye-slim AS terraform-github-actions-base
1010

1111
# Terraform environment variables
1212
ENV CHECKPOINT_DISABLE=true
1313
ENV TF_IN_AUTOMATION=true
1414
ENV TF_INPUT=false
1515
ENV TF_PLUGIN_CACHE_DIR=/usr/local/share/terraform/plugin-cache
1616

17-
RUN apt-get update \
18-
&& apt-get install --no-install-recommends -y \
17+
RUN <<EOF
18+
apt-get update
19+
apt-get install --no-install-recommends -y \
1920
git \
2021
ssh \
2122
tar \
@@ -31,12 +32,23 @@ RUN apt-get update \
3132
gpg \
3233
gpg-agent \
3334
dirmngr \
34-
tree \
35-
&& rm -rf /var/lib/apt/lists/*
35+
tree
36+
rm -rf /var/lib/apt/lists/*
3637

37-
RUN mkdir -p $TF_PLUGIN_CACHE_DIR
38+
mkdir -p $TF_PLUGIN_CACHE_DIR
39+
40+
gpg --recv-keys C874011F0AB405110D02105534365D9472D7468F
41+
echo "C874011F0AB405110D02105534365D9472D7468F:6:" | gpg --import-ownertrust
42+
43+
curl https://get.opentofu.org/opentofu.gpg | gpg --import
44+
echo "E3E6E43D84CB852EADB0051D0C0AF313E5FD9F80:6:" | gpg --import-ownertrust
45+
46+
gpg --check-trustdb
47+
48+
echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
49+
echo "IdentityFile /.ssh/id_rsa" >> /etc/ssh/ssh_config
50+
mkdir -p /.ssh
51+
EOF
3852

3953
COPY --from=tfmask /go/tfmask/release/tfmask /usr/local/bin/tfmask
4054
ENV TFMASK_RESOURCES_REGEX="(?i)^(random_id|kubernetes_secret|acme_certificate).*$"
41-
42-
ENTRYPOINT ["/usr/local/bin/terraform"]

0 commit comments

Comments
 (0)