forked from mminks/dind-aech
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (42 loc) · 1.67 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
FROM docker:stable-dind as ecr-login
RUN set -exo pipefail \
&& apk add --no-cache \
gettext \
git \
go \
make \
musl-dev \
&& go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login
FROM docker:stable-dind as terraform
RUN set -exo pipefail \
&& apk add --no-cache \
curl \
jq \
&& TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq --raw-output '.current_version') \
&& wget --output-document=/tmp/terraform.zip \
"https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" \
&& unzip /tmp/terraform.zip -d /usr/local/bin
FROM docker:stable-dind
WORKDIR /root
COPY bin/* /usr/local/bin/
COPY --from=ecr-login /root/go/bin/docker-credential-ecr-login /usr/local/bin/docker-credential-ecr-login
COPY --from=ecr-login /usr/bin/envsubst /usr/local/bin/envsubst
COPY --from=terraform /usr/local/bin/terraform /usr/local/bin/terraform
RUN set -exo pipefail \
&& apk add --no-cache \
libintl \
openssh-client \
openssl \
python3 \
# Setup ecr-login
&& mkdir -p /root/.docker \
&& echo "{ \"credsStore\": \"ecr-login\" }" > /root/.docker/config.json \
# Install aws
&& wget --output-document=/tmp/awscli-bundle.zip \
"https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" \
&& unzip /tmp/awscli-bundle.zip -d /tmp \
&& /usr/bin/python3 /tmp/awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws \
&& rm -rf /tmp/awscli-bundle* \
&& rm -rf /var/cache/apk/* \
&& aws --version \
&& terraform version