-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
281 lines (237 loc) · 8.31 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
FROM ubuntu:18.04
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
### SYSTEM DEPENDENCIES
ENV DEBIAN_FRONTEND="noninteractive" \
LC_ALL="en_US.UTF-8" \
LANG="en_US.UTF-8"
# Everything from `make` onwards in apt-get install is only installed to ensure
# Python support works with all packages (which may require specific libraries
# at install time).
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
build-essential \
dirmngr \
git \
bzr \
mercurial \
gnupg2 \
ca-certificates \
curl \
file \
zlib1g-dev \
liblzma-dev \
tzdata \
zip \
unzip \
locales \
openssh-client \
software-properties-common \
make \
less \
libpq-dev \
libssl-dev \
libbz2-dev \
libffi-dev \
libreadline-dev \
libsqlite3-dev \
libcurl4-openssl-dev \
llvm \
libncurses5-dev \
libncursesw5-dev \
libmysqlclient-dev \
nano \
sshpass \
expect \
xz-utils \
tk-dev \
libxml2-dev \
libxmlsec1-dev \
libgeos-dev \
python3-enchant \
&& apt-get install -y openssh-client \
&& locale-gen en_US.UTF-8 \
&& rm -rf /var/lib/apt/lists/*
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN if ! getent group "$USER_GID"; then groupadd --gid "$USER_GID" jenkins ; \
else GROUP_NAME=$(getent group $USER_GID | awk -F':' '{print $1}'); groupmod -n jenkins "$GROUP_NAME" ; fi \
&& useradd --uid "${USER_UID}" --gid "${USER_GID}" -m jenkins \
&& mkdir -p /opt && chown jenkins:jenkins /opt
### RUBY
# Install Ruby 2.7, update RubyGems, and install Bundler
ENV BUNDLE_SILENCE_ROOT_WARNING=1
# Disable the outdated rubygems installation from being loaded
ENV DEBIAN_DISABLE_RUBYGEMS_INTEGRATION=true
# Allow gem installs as the dependabot user
ENV BUNDLE_PATH=".bundle" \
BUNDLE_BIN=".bundle/bin"
ENV PATH="$BUNDLE_BIN:$PATH:$BUNDLE_PATH/bin"
RUN apt-add-repository ppa:brightbox/ruby-ng \
&& apt-get update \
&& apt-get install -y --no-install-recommends ruby2.7 ruby2.7-dev \
&& gem update --system 3.2.20 \
&& gem install bundler -v 1.17.3 --no-document \
&& gem install bundler -v 2.2.26 --no-document \
&& rm -rf /var/lib/gems/2.7.0/cache/* \
&& rm -rf /var/lib/apt/lists/*
### PYTHON
# Install Python 2.7 and 3.9 with pyenv. Using pyenv lets us support multiple Pythons
ENV PYENV_ROOT=/usr/local/.pyenv \
PATH="/usr/local/.pyenv/bin:$PATH"
RUN mkdir -p "$PYENV_ROOT" && chown jenkins:jenkins "$PYENV_ROOT"
USER jenkins
RUN git clone https://github.com/pyenv/pyenv.git --branch v2.1.0 --single-branch --depth=1 /usr/local/.pyenv \
&& pyenv install 3.10.0 \
&& pyenv global 3.10.0 \
&& rm -Rf /tmp/python-build*
USER root
### JAVASCRIPT
# Install Node 14.0 and npm v7
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/* \
&& npm install -g npm@v7.21.0 \
&& rm -rf ~/.npm
### ELM
#Install Elm 0.19
ENV PATH="$PATH:/node_modules/.bin"
RUN curl -sSLfO "https://github.com/elm/compiler/releases/download/0.19.0/binaries-for-linux.tar.gz" \
&& tar xzf binaries-for-linux.tar.gz \
&& mv elm /usr/local/bin/elm19 \
&& rm -f binaries-for-linux.tar.gz
### PHP
# Install PHP 7.4 and Composer
ENV COMPOSER_ALLOW_SUPERUSER=1
COPY --from=composer:1.10.9 /usr/bin/composer /usr/local/bin/composer1
COPY --from=composer:2.0.8 /usr/bin/composer /usr/local/bin/composer
RUN add-apt-repository ppa:ondrej/php \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
php7.4 \
php7.4-apcu \
php7.4-bcmath \
php7.4-cli \
php7.4-common \
php7.4-curl \
php7.4-gd \
php7.4-geoip \
php7.4-gettext \
php7.4-gmp \
php7.4-imagick \
php7.4-imap \
php7.4-intl \
php7.4-json \
php7.4-ldap \
php7.4-mbstring \
php7.4-memcached \
php7.4-mongodb \
php7.4-mysql \
php7.4-redis \
php7.4-soap \
php7.4-sqlite3 \
php7.4-tidy \
php7.4-xml \
php7.4-zip \
php7.4-zmq \
&& rm -rf /var/lib/apt/lists/*
USER jenkins
# Perform a fake `composer update` to warm ~/dependabot/.cache/composer/repo
# with historic data (we don't care about package files here)
RUN mkdir /tmp/composer-cache \
&& cd /tmp/composer-cache \
&& echo '{"require":{"psr/log": "^1.1.3"}}' > composer.json \
&& composer update --no-scripts --dry-run \
&& cd /tmp \
&& rm -rf /home/dependabot/.cache/composer/files \
&& rm -rf /tmp/composer-cache
USER root
#GO
##Install Go
ARG GOLANG_VERSION=1.17.1
ARG GOLANG_CHECKSUM=dab7d9c34361dc21ec237d584590d72500652e7c909bf082758fb63064fca0ef
ENV PATH=/opt/go/bin:$PATH
RUN cd /tmp \
&& curl --http1.1 -o go.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz \
&& echo "$GOLANG_CHECKSUM go.tar.gz" | sha256sum -c - \
&& tar -xzf go.tar.gz -C /opt \
&& rm go.tar.gz
#ELIXIR
##Install Erlang, Elixir and Hex
ENV PATH="$PATH:/usr/local/elixir/bin"
# https://github.com/elixir-lang/elixir/releases
ARG ELIXIR_VERSION=v1.12.2
ARG ELIXIR_CHECKSUM=38eb2281032b0cb096ef5e61f048c5374d6fb9bf4078ab8f9526a42e16e7c661732a632b55d6072328eedf87a47e6eeb3f0e3f90bba1086239c71350f90c75e5
# This version is currently pinned to OTP 23, due to an issue that we only hit
# in production, where traffic is routed through a proxy that OTP 24 doesn't
# play nice with.
ARG ERLANG_VERSION=1:23.3.4.5-1
RUN curl -sSLfO https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb \
&& dpkg -i erlang-solutions_1.0_all.deb \
&& apt-get update \
&& apt-get install -y --no-install-recommends esl-erlang=${ERLANG_VERSION} \
&& curl -sSLfO https://github.com/elixir-lang/elixir/releases/download/${ELIXIR_VERSION}/Precompiled.zip \
&& echo "$ELIXIR_CHECKSUM Precompiled.zip" | sha512sum -c - \
&& unzip -d /usr/local/elixir -x Precompiled.zip \
&& rm -f Precompiled.zip erlang-solutions_1.0_all.deb \
&& mix local.hex --force \
&& rm -rf /var/lib/apt/lists/*
#RUST
#Install Rust 1.51.0
ENV RUSTUP_HOME=/opt/rust \
CARGO_HOME=/opt/rust \
PATH="${PATH}:/opt/rust/bin"
RUN mkdir -p "$RUSTUP_HOME" && chown jenkins:jenkins "$RUSTUP_HOME"
USER jenkins
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y \
&& rustup toolchain install 1.51.0 && rustup default 1.51.0
### CLOJURE
USER root
# Install leiningen
RUN apt-get update \
&& apt-get install -y openjdk-8-jre-headless \
&& java -version \
&& curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > lein \
&& mkdir -p /usr/local/lein/bin \
&& mv lein /usr/local/lein/bin \
&& chmod +x /usr/local/lein/bin/lein \
&& /usr/local/lein/bin/lein --version
ENV PATH="$PATH:/usr/local/lein/bin" \
LEIN_SNAPSHOTS_IN_RELEASE="yes"
###Terraform
USER root
ARG TERRAFORM_VERSION=1.0.6
RUN curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add -
RUN apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" \
&& apt-get update -y \
&& apt-get install -y --no-install-recommends terraform=${TERRAFORM_VERSION} \
&& terraform -help \
&& rm -rf /var/lib/apt/lists/*
USER root
COPY --chown=jenkins:jenkins composer/helpers /opt/composer/helpers
COPY --chown=jenkins:jenkins bundler/helpers /opt/bundler/helpers
COPY --chown=jenkins:jenkins go_modules/helpers /opt/go_modules/helpers
COPY --chown=jenkins:jenkins hex/helpers /opt/hex/helpers
COPY --chown=jenkins:jenkins npm_and_yarn/helpers /opt/npm_and_yarn/helpers
COPY --chown=jenkins:jenkins python/helpers /opt/python/helpers
COPY --chown=jenkins:jenkins terraform/helpers /opt/terraform/helpers
COPY --chown=jenkins:jenkins lein/helpers /opt/lein/helpers
ENV DEPENDABOT_NATIVE_HELPERS_PATH="/opt" \
PATH="$PATH:/opt/terraform/bin:/opt/python/bin:/opt/go_modules/bin" \
MIX_HOME="/opt/hex/mix"
USER jenkins
RUN mkdir -p /opt/bundler/v1 \
&& mkdir -p /opt/bundler/v2
RUN bash /opt/lein/helpers/build /opt/lein
RUN bash /opt/bundler/helpers/v1/build /opt/bundler/v1
RUN bash /opt/bundler/helpers/v2/build /opt/bundler/v2
RUN bash /opt/go_modules/helpers/build /opt/go_modules
RUN bash /opt/hex/helpers/build /opt/hex
RUN bash /opt/npm_and_yarn/helpers/build /opt/npm_and_yarn
RUN bash /opt/python/helpers/build /opt/python
RUN bash /opt/terraform/helpers/build /opt/terraform
RUN bash /opt/composer/helpers/v1/build /opt/composer/v1
RUN bash /opt/composer/helpers/v2/build /opt/composer/v2
ENV HOME="/home/dependabot"
WORKDIR ${HOME}
CMD ["/bin/bash"]