-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
185 lines (161 loc) · 9.81 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#--------------------------#
# Docker #
#--------------------------#
FROM docker:18.09.2 AS static-docker-source
##--------------------------#
## Golang Builder #
##--------------------------#
#
#FROM golang:1.12 AS builder
#
#ENV GOPATH /go
#RUN go get github.com/OJ/gobuster
#WORKDIR /go/src/github.com/OJ/gobuster
#RUN make linux
#--------------------------#
# Dependencies #
#--------------------------#
FROM debian:buster-slim AS dependencies
RUN DEBIAN_FRONTEND=noninteractive apt update && apt install --assume-yes --no-install-recommends \
bash \
ca-certificates \
curl
# bash 4 required for `pipefail`
SHELL ["/bin/bash", "-c"]
RUN mkdir /dependencies /downloads
WORKDIR /downloads
# Install doctl (Digital Ocean CLI)
ARG DOCTL_VERSION=1.46.0
RUN set -euxo pipefail; curl -sL "https://github.com/digitalocean/doctl/releases/download/v${DOCTL_VERSION}/doctl-${DOCTL_VERSION}-linux-amd64.tar.gz" \
| tar -xz \
&& mv doctl /dependencies/
# Install github hub
ARG HUB_VERSION=2.6.0
RUN set -euxo pipefail; curl -sL "https://github.com/github/hub/releases/download/v${HUB_VERSION}/hub-linux-amd64-${HUB_VERSION}.tgz" \
| tar -xz \
&& mv ./hub-linux-amd64-*/bin/hub /dependencies/
# Install AWS IAM authenticator for EKS
ARG AWS_AUTHENTICATOR_VERSION="1.17.9/2020-08-04"
RUN curl -sLo /dependencies/aws-iam-authenticator \
"https://amazon-eks.s3-us-west-2.amazonaws.com/${AWS_AUTHENTICATOR_VERSION}/bin/linux/amd64/aws-iam-authenticator" \
&& chmod +x /dependencies/aws-iam-authenticator
# Install notary
ARG NOTARY_VERSION=0.6.1
RUN curl -sLo /dependencies/notary \
"https://github.com/theupdateframework/notary/releases/download/v${NOTARY_VERSION}/notary-Linux-amd64" \
&& chmod +x /dependencies/notary
# Install docker-compose
ARG DOCKER_COMPOSE_VERSION=1.27.3
RUN curl -sLo /dependencies/docker-compose \
"https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" \
&& chmod +x /dependencies/docker-compose
# Install goss
ARG GOSS_VERSION=0.3.13
RUN curl -sLo /dependencies/goss \
"https://github.com/aelsabbahy/goss/releases/download/v${GOSS_VERSION}/goss-linux-amd64" \
&& chmod +x /dependencies/goss
# Install conftest
ARG CONFTEST_VERSION=0.21.0
RUN set -euxo pipefail; curl -sL "https://github.com/instrumenta/conftest/releases/download/v${CONFTEST_VERSION}/conftest_${CONFTEST_VERSION}_Linux_x86_64.tar.gz" \
| tar -xz \
&& mv conftest /dependencies/
# Install jq
ARG JQ_VERSION=1.6
RUN curl -sLo /dependencies/jq \
"https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64" \
&& chmod +x /dependencies/jq
# Install yq
ARG YQ_VERSION=2.1.1
RUN curl -sLo /dependencies/yq \
"https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64" \
&& chmod +x /dependencies/yq
# Install kustomize
ARG KUSTOMIZE_VERSION=2.0.2
RUN curl -sLo /dependencies/kustomize \
"https://github.com/kubernetes-sigs/kustomize/releases/download/v${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_linux_amd64" \
&& chmod +x /dependencies/kustomize
ARG CLOUD_NUKE_VERSION=v0.1.13
RUN curl -sLo /dependencies/cloud-nuke \
"https://github.com/gruntwork-io/cloud-nuke/releases/download/${CLOUD_NUKE_VERSION}/cloud-nuke_linux_amd64" \
&& chmod +x /dependencies/cloud-nuke
#--------------------------#
# docker-gcloud-sdk #
#--------------------------#
FROM debian:buster-slim AS docker-gcloud-sdk
# 349.0.0 (2021-07-20)
ENV CLOUD_SDK_VERSION 349.0.0
RUN DEBIAN_FRONTEND=noninteractive apt update && \
apt install --assume-yes --no-install-recommends \
\
apt-transport-https \
awscli \
bash \
bzip2 \
ca-certificates \
curl \
dnsutils \
gawk \
gettext-base \
git \
gnupg \
golang \
lsb-release \
lsof \
make \
ncat \
nmap \
nmap-common \
openssh-client \
parallel \
postgresql-client \
rsync \
wget \
xmlstarlet \
\
&& export CLOUD_SDK_REPO \
&& CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" \
&& echo "deb https://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" > /etc/apt/sources.list.d/google-cloud-sdk.list \
&& bash -euxo pipefail -c "curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - " \
\
&& DEBIAN_FRONTEND=noninteractive \
apt update && apt install --assume-yes --no-install-recommends \
google-cloud-sdk=${CLOUD_SDK_VERSION}-0 \
kubectl \
\
&& rm -rf /var/lib/apt/lists/* \
\
\
&& gcloud config set core/disable_usage_reporting true \
&& gcloud config set component_manager/disable_update_check true \
&& gcloud config set metrics/environment github_docker_image \
&& ssh-keyscan -H github.com gitlab.com bitbucket.org >> /etc/ssh/ssh_known_hosts \
&& useradd -u 1000 -ms /bin/bash jenkins
# Install bats-core
ARG BATS_SHA=18f574c0deaa3f0299fa7aa1120c61f9fb430ad8
RUN cd /opt/ \
&& git clone https://github.com/bats-core/bats-core.git \
&& cd bats-core/ \
&& git checkout ${BATS_SHA} \
&& ./install.sh /usr/local
# Copy binaries from dependencies
COPY --from=dependencies /dependencies/* /usr/local/bin/
# Copy docker
COPY --from=static-docker-source /usr/local/bin/docker /usr/local/bin/docker
## Copy built gobuster
#COPY --from=builder /go/src/github.com/OJ/gobuster/build/gobuster-linux-amd64/gobuster /usr/local/bin/
# Print versions of all installed tools
RUN gcloud --version \
&& docker --version \
&& kubectl version --client \
&& bats --version \
&& doctl version \
&& hub --version \
&& aws-iam-authenticator --help \
&& notary help \
&& docker-compose version \
&& goss help \
&& conftest --version \
&& jq --version \
&& yq --version \
&& kustomize version \
&& cloud-nuke --version