-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile
78 lines (54 loc) · 1.84 KB
/
Dockerfile
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
ARG BASE_IMAGE=alpine:3.20
FROM ${BASE_IMAGE} AS base
ARG TARGETARCH
RUN apk -U upgrade && apk add --no-cache \
bash \
ca-certificates \
curl \
git \
jq \
openssh-client \
openssh-keygen \
python3 \
tzdata
RUN [ -e /usr/bin/python ] || ln -s python3 /usr/bin/python
# Download infracost
ADD "https://github.com/infracost/infracost/releases/latest/download/infracost-linux-${TARGETARCH}.tar.gz" /tmp/infracost.tar.gz
RUN tar -xzf /tmp/infracost.tar.gz -C /bin && \
mv "/bin/infracost-linux-${TARGETARCH}" /bin/infracost && \
chmod 755 /bin/infracost && \
rm /tmp/infracost.tar.gz
# Download Terragrunt.
ADD "https://github.com/gruntwork-io/terragrunt/releases/latest/download/terragrunt_linux_${TARGETARCH}" /bin/terragrunt
RUN chmod 755 /bin/terragrunt
RUN echo "hosts: files dns" > /etc/nsswitch.conf \
&& adduser --disabled-password --uid=1983 spacelift
FROM base AS aws
COPY --from=ghcr.io/spacelift-io/aws-cli-alpine /usr/local/aws-cli/ /usr/local/aws-cli/
COPY --from=ghcr.io/spacelift-io/aws-cli-alpine /aws-cli-bin/ /usr/local/bin/
RUN aws --version && \
terragrunt --version && \
python --version && \
infracost --version
USER spacelift
FROM base AS gcp
RUN gcloud components install gke-gcloud-auth-plugin
RUN gcloud --version && \
terragrunt --version && \
python --version && \
infracost --version
USER spacelift
FROM base AS azure-build
RUN apk add --no-cache py3-pip gcc musl-dev python3-dev libffi-dev openssl-dev cargo make
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install --no-cache-dir azure-cli
FROM base AS azure
ENV PATH="/opt/venv/bin:$PATH"
COPY --from=azure-build /opt/venv /opt/venv
RUN apk add --no-cache py3-pip && \
az --version && \
terragrunt --version && \
python --version && \
infracost --version
USER spacelift