1
- # Copyright 2019-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2019-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
#
3
3
# Licensed under the Amazon Software License (the "License"). You may not use this file except in compliance with the License.
4
4
# A copy of the License is located at
@@ -13,8 +13,10 @@ FROM public.ecr.aws/amazonlinux/amazonlinux:2 AS core
13
13
14
14
# Install git, SSH, and other utilities
15
15
RUN set -ex \
16
- && yum install -yq openssh-clients \
16
+ && yum install -y -q openssh-clients \
17
17
&& mkdir ~/.ssh \
18
+ && mkdir -p /opt/tools \
19
+ && mkdir -p /codebuild/image/config \
18
20
&& touch ~/.ssh/known_hosts \
19
21
&& ssh-keyscan -t rsa,dsa -H github.com >> ~/.ssh/known_hosts \
20
22
&& ssh-keyscan -t rsa,dsa -H bitbucket.org >> ~/.ssh/known_hosts \
@@ -23,8 +25,8 @@ RUN set -ex \
23
25
&& rpm --import https://download.mono-project.com/repo/xamarin.gpg \
24
26
&& curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo \
25
27
&& amazon-linux-extras enable corretto8 \
26
- && yum groupinstall -yq "Development tools" \
27
- && yum install -yq \
28
+ && yum groupinstall -y -q "Development tools" \
29
+ && yum install -y -q \
28
30
GeoIP-devel ImageMagick asciidoc bzip2-devel bzr bzrtools cvs cvsps \
29
31
docbook-dtds docbook-style-xsl dpkg-dev e2fsprogs expat-devel expect fakeroot \
30
32
glib2-devel groff gzip icu iptables jq krb5-server libargon2-devel \
@@ -54,12 +56,12 @@ RUN set -ex \
54
56
&& cd git-$GIT_VERSION \
55
57
&& make -j4 prefix=/usr \
56
58
&& make install prefix=/usr \
57
- && cd .. ; rm -rf git-$GIT_VERSION \
59
+ && cd .. && rm -rf git-$GIT_VERSION \
58
60
&& rm -rf $GIT_TAR_FILE /tmp/*
59
61
60
62
# Install Firefox
61
63
RUN set -ex \
62
- && yum install -yq gtk3-devel dbus-glib-devel \
64
+ && yum install -y -q gtk3-devel dbus-glib-devel \
63
65
&& wget -qO ~/FirefoxSetup.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64" \
64
66
&& tar xjf ~/FirefoxSetup.tar.bz2 -C /opt/ \
65
67
&& ln -s /opt/firefox/firefox /usr/local/bin/firefox \
@@ -77,7 +79,7 @@ RUN set -ex \
77
79
78
80
# Install Chromium
79
81
RUN set -ex \
80
- && yum install -yq chromium
82
+ && yum install -y -q chromium
81
83
82
84
# Install ChromeDriver
83
85
RUN set -ex \
@@ -96,17 +98,15 @@ RUN set -ex \
96
98
&& STUNNEL_VERSION=5.56 \
97
99
&& STUNNEL_TAR=stunnel-$STUNNEL_VERSION.tar.gz \
98
100
&& STUNNEL_SHA256="7384bfb356b9a89ddfee70b5ca494d187605bb516b4fff597e167f97e2236b22" \
99
- && curl -o $STUNNEL_TAR https://www.usenix.org.uk/mirrors/stunnel/archive/5.x/$STUNNEL_TAR \
100
- && echo "$STUNNEL_SHA256 $STUNNEL_TAR" | sha256sum -c - \
101
- && tar xfz $STUNNEL_TAR \
101
+ && curl -o $STUNNEL_TAR https://www.usenix.org.uk/mirrors/stunnel/archive/5.x/$STUNNEL_TAR && echo "$STUNNEL_SHA256 $STUNNEL_TAR" | sha256sum --check && tar xfz $STUNNEL_TAR \
102
102
&& cd stunnel-$STUNNEL_VERSION \
103
103
&& ./configure \
104
104
&& make -j4 \
105
105
&& make install \
106
106
&& openssl genrsa -out key.pem 2048 \
107
107
&& openssl req -new -x509 -key key.pem -out cert.pem -days 1095 -subj "/C=US/ST=Washington/L=Seattle/O=Amazon/OU=Codebuild/CN=codebuild.amazon.com" \
108
108
&& cat key.pem cert.pem >> /usr/local/etc/stunnel/stunnel.pem \
109
- && cd .. ; rm -rf stunnel-${STUNNEL_VERSION}*
109
+ && cd .. && rm -rf stunnel-${STUNNEL_VERSION}*
110
110
111
111
# AWS Tools
112
112
# https://docs.aws.amazon.com/eks/latest/userguide/install-aws-iam-authenticator.html https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_CLI_installation.html
@@ -117,7 +117,7 @@ RUN curl -sS -o /usr/local/bin/aws-iam-authenticator https://amazon-eks.s3-us-we
117
117
118
118
# Configure SSM
119
119
RUN set -ex \
120
- && yum install -yq https://s3.amazonaws.com/amazon-ssm-us-east-1/3.0.1390.0/linux_amd64/amazon-ssm-agent.rpm
120
+ && yum install -y -q https://s3.amazonaws.com/amazon-ssm-us-east-1/3.0.1390.0/linux_amd64/amazon-ssm-agent.rpm
121
121
122
122
# Install env tools for runtimes
123
123
# # Dotnet
@@ -162,7 +162,7 @@ ENV GOPATH="/go"
162
162
FROM tools AS runtimes_1
163
163
164
164
# **************** JAVA ****************************************************
165
- COPY tools/android-accept-licenses.sh /opt/tools/android-accept-licenses.sh
165
+ RUN cat tools/android-accept-licenses.sh > /opt/tools/android-accept-licenses.sh && chmod 755 /opt/tools/android-accept-licenses.sh
166
166
167
167
ENV JAVA_11_HOME="/opt/jvm/amazon-corretto-11" \
168
168
JDK_11_HOME="/opt/jvm/amazon-corretto-11" \
@@ -175,7 +175,7 @@ ENV JAVA_11_HOME="/opt/jvm/amazon-corretto-11" \
175
175
MAVEN_VERSION=3.6.3 \
176
176
INSTALLED_GRADLE_VERSIONS="4.10.3 5.4.1" \
177
177
GRADLE_VERSION=5.4.1 \
178
- SBT_VERSION=1.2.8 \
178
+ SBT_VERSION=1.6.1 \
179
179
JDK_VERSION=11.0.5.10.1 \
180
180
ANDROID_HOME="/usr/local/android-sdk-linux" \
181
181
GRADLE_PATH="$SRC_DIR/gradle" \
@@ -190,7 +190,8 @@ ENV JAVA_11_HOME="/opt/jvm/amazon-corretto-11" \
190
190
MAVEN_DOWNLOAD_SHA512="c35a1803a6e70a126e80b2b3ae33eed961f83ed74d18fcd16909b2d44d7dada3203f1ffe726c17ef8dcca2dcaa9fca676987befeadc9b9f759967a8cb77181c0" \
191
191
GRADLE_DOWNLOADS_SHA256="14cd15fc8cc8705bd69dcfa3c8fefb27eb7027f5de4b47a8b279218f76895a91 5.4.1\n 336b6898b491f6334502d8074a6b8c2d73ed83b92123106bd4bf837f04111043 4.10.3" \
192
192
ANDROID_SDK_MANAGER_SHA256="92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9" \
193
- SBT_DOWNLOAD_SHA256="9bb9212541176d6fcce7bd12e4cf8a9c9649f5b63f88b3aff474e0b02c7cfe58"
193
+ SBT_DOWNLOAD_SHA256="60286bf1b875b31e2955f8a699888cd2612e9afd94d03cde0a2e71efd7492ffc" \
194
+ LOG4J_UNSAFE_VERSIONS="2.11.1 1.2.8"
194
195
195
196
ARG MAVEN_CONFIG_HOME="/root/.m2"
196
197
ENV JDK_DOWNLOAD_TAR="amazon-corretto-${JDK_VERSION}-linux-x64.tar.gz" \
@@ -203,7 +204,7 @@ ENV JDK_DOWNLOAD_URL="https://d3pxv6yz143wms.cloudfront.net/${JDK_VERSION}/${JDK
203
204
204
205
RUN set -ex \
205
206
# Install Amazon Corretto 8
206
- && yum install -yq java-1.8.0-amazon-corretto-devel \
207
+ && yum install -y -q java-1.8.0-amazon-corretto-devel \
207
208
# Ensure Java cacerts symlink points to valid location
208
209
&& update-ca-trust
209
210
@@ -275,9 +276,11 @@ RUN set -ex \
275
276
&& curl -fSL "https://github.com/sbt/sbt/releases/download/v${SBT_VERSION}/sbt-${SBT_VERSION}.tgz" -o sbt.tgz \
276
277
&& echo "${SBT_DOWNLOAD_SHA256} *sbt.tgz" | sha256sum -c - \
277
278
&& tar xzf sbt.tgz -C /usr/local/bin/ \
278
- && rm sbt.tgz
279
+ && rm sbt.tgz \
280
+ && for version in $LOG4J_UNSAFE_VERSIONS; do find / -name log4j*-$version.jar | xargs rm -f; done
281
+
279
282
ENV PATH "/usr/local/bin/sbt/bin:$PATH"
280
- RUN sbt version
283
+ RUN sbt version -Dsbt.rootdir=true
281
284
# Cleanup
282
285
RUN rm -fr /tmp/* /var/tmp/*
283
286
# **************** END JAVA ****************************************************
@@ -309,17 +312,18 @@ ENV NODE_10_VERSION="10.19.0"
309
312
RUN n $NODE_10_VERSION && npm install --save-dev -g -f grunt && npm install --save-dev -g -f grunt-cli && npm install --save-dev -g -f webpack \
310
313
&& curl -sSL https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo \
311
314
&& rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg \
312
- && yum install -yq yarn \
315
+ && yum install -y https://download-ib01.fedoraproject.org/pub/epel/8/Modular/x86_64/Packages/l/libuv-1.43.0-2.module_el8+13774+f8c1f5a5.x86_64.rpm \
316
+ && yum install -y -q yarn \
313
317
&& yarn --version \
314
- && cd / && rm -rf $N_SRC_DIR; rm -rf /tmp/*
318
+ && cd / && rm -rf $N_SRC_DIR && rm -rf /tmp/*
315
319
316
320
# **************** END NODEJS ****************************************************
317
321
318
322
# **************** RUBY *********************************************************
319
323
320
324
ENV RUBY_26_VERSION="2.6.5"
321
325
322
- RUN rbenv install $RUBY_26_VERSION; rm -rf /tmp/*; rbenv global $RUBY_26_VERSION; ruby -v
326
+ RUN rbenv install $RUBY_26_VERSION && rm -rf /tmp/* && rbenv global $RUBY_26_VERSION && ruby -v
323
327
324
328
# **************** END RUBY *****************************************************
325
329
@@ -328,8 +332,8 @@ ENV PYTHON_37_VERSION="3.7.10"
328
332
ENV PYTHON_PIP_VERSION=21.1.2
329
333
ENV PYYAML_VERSION=5.4.1
330
334
331
- COPY tools/runtime_configs/python/$PYTHON_37_VERSION /root/.pyenv/plugins/python-build/share/python-build/$PYTHON_37_VERSION
332
- RUN env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYTHON_37_VERSION; rm -rf /tmp/*
335
+ RUN cat tools/runtime_configs/python/$PYTHON_37_VERSION > /root/.pyenv/plugins/python-build/share/python-build/$PYTHON_37_VERSION
336
+ RUN env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYTHON_37_VERSION && rm -rf /tmp/*
333
337
RUN pyenv global $PYTHON_37_VERSION
334
338
RUN set -ex \
335
339
&& pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
@@ -341,8 +345,8 @@ RUN set -ex \
341
345
# **************** PHP ****************************************************
342
346
ENV PHP_73_VERSION="7.3.13"
343
347
344
- COPY tools/runtime_configs/php/$PHP_73_VERSION /root/.phpenv/plugins/php-build/share/php-build/definitions/$PHP_73_VERSION
345
- RUN phpenv install $PHP_73_VERSION; rm -rf /tmp/*; phpenv global $PHP_73_VERSION
348
+ RUN cat tools/runtime_configs/php/$PHP_73_VERSION > /root/.phpenv/plugins/php-build/share/php-build/definitions/$PHP_73_VERSION
349
+ RUN phpenv install $PHP_73_VERSION && rm -rf /tmp/* && phpenv global $PHP_73_VERSION
346
350
RUN echo "memory_limit = 1G;" >> "/root/.phpenv/versions/$PHP_73_VERSION/etc/conf.d/memory.ini"
347
351
348
352
# Install Composer globally
@@ -356,25 +360,24 @@ ENV GOLANG_13_VERSION="1.13.15" \
356
360
ENV GOENV_DISABLE_GOPATH=1
357
361
ENV GOPATH="/go"
358
362
359
- RUN goenv install $GOLANG_12_VERSION; rm -rf /tmp/*
363
+ RUN goenv install $GOLANG_12_VERSION && rm -rf /tmp/*
360
364
361
- RUN goenv install $GOLANG_13_VERSION; rm -rf /tmp/*; \
362
- goenv global $GOLANG_13_VERSION
365
+ RUN goenv install $GOLANG_13_VERSION && rm -rf /tmp/* && goenv global $GOLANG_13_VERSION
363
366
364
367
RUN go get -u github.com/golang/dep/cmd/dep
365
368
# **************** END GOLANG ****************************************************
366
369
367
370
# =======================End of layer: runtimes_1 =================
368
371
FROM runtimes_1 AS runtimes_2
369
372
370
- # Docker 19
373
+ # Docker 20
371
374
ENV DOCKER_BUCKET="download.docker.com" \
372
375
DOCKER_CHANNEL="stable" \
373
376
DIND_COMMIT="3b5fac462d21ca164b3778647420016315289034" \
374
377
DOCKER_COMPOSE_VERSION="1.24.0"
375
378
376
- ENV DOCKER_SHA256="caf74e54b58c0b38bb4d96c8f87665f29b684371c9a325562a3904b8c389995e "
377
- ENV DOCKER_VERSION="20.10.9 "
379
+ ENV DOCKER_SHA256="dd6ff72df1edfd61ae55feaa4aadb88634161f0aa06dbaaf291d1be594099ff3 "
380
+ ENV DOCKER_VERSION="20.10.11 "
378
381
379
382
VOLUME /var/lib/docker
380
383
@@ -397,8 +400,8 @@ RUN set -ex \
397
400
# Python 3.8
398
401
ENV PYTHON_38_VERSION="3.8.10"
399
402
400
- COPY tools/runtime_configs/python/$PYTHON_38_VERSION /root/.pyenv/plugins/python-build/share/python-build/$PYTHON_38_VERSION
401
- RUN env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYTHON_38_VERSION; rm -rf /tmp/*
403
+ RUN cat tools/runtime_configs/python/$PYTHON_38_VERSION > /root/.pyenv/plugins/python-build/share/python-build/$PYTHON_38_VERSION
404
+ RUN env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYTHON_38_VERSION && rm -rf /tmp/*
402
405
RUN pyenv global $PYTHON_38_VERSION
403
406
RUN set -ex \
404
407
&& pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
@@ -408,8 +411,8 @@ RUN set -ex \
408
411
# Python 3.9
409
412
ENV PYTHON_39_VERSION="3.9.5"
410
413
411
- COPY tools/runtime_configs/python/$PYTHON_39_VERSION /root/.pyenv/plugins/python-build/share/python-build/$PYTHON_39_VERSION
412
- RUN env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYTHON_39_VERSION; rm -rf /tmp/*
414
+ RUN cat tools/runtime_configs/python/$PYTHON_39_VERSION > /root/.pyenv/plugins/python-build/share/python-build/$PYTHON_39_VERSION
415
+ RUN env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYTHON_39_VERSION && rm -rf /tmp/*
413
416
RUN pyenv global $PYTHON_39_VERSION
414
417
RUN set -ex \
415
418
&& pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
@@ -456,14 +459,15 @@ ENV MAVEN_CONFIG=$MAVEN_CONFIG_HOME
456
459
ENV DEBIAN_FRONTEND="noninteractive"
457
460
458
461
# Configure SSH
459
- COPY ssh_config /root/.ssh/config
460
- COPY runtimes.yml /codebuild/image/config/runtimes.yml
461
- COPY dockerd-entrypoint.sh /usr/local/bin/
462
- COPY legal/THIRD_PARTY_LICENSES.txt /usr/share/doc
463
- COPY legal/bill_of_material.txt /usr/share/doc
464
- COPY amazon-ssm-agent.json /etc/amazon/ssm/
465
-
466
- ENTRYPOINT ["dockerd-entrypoint.sh" ]
462
+ RUN cat ssh_config > /root/.ssh/config
463
+ RUN cat runtimes.yml > /codebuild/image/config/runtimes.yml
464
+ RUN cat dockerd-entrypoint.sh > /usr/local/bin/dockerd-entrypoint.sh
465
+ RUN chmod +x /usr/local/bin/dockerd-entrypoint.sh
466
+ RUN cat legal/THIRD_PARTY_LICENSES.txt > /usr/share/doc/THIRD_PARTY_LICENSES.txt
467
+ RUN cat legal/bill_of_material.txt > /usr/share/doc/bill_of_material.txt
468
+ RUN cat amazon-ssm-agent.json > /etc/amazon/ssm/amazon-ssm-agent.json
469
+
470
+ ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh" ]
467
471
468
472
# =======================End of layer: al2_v1 =================
469
473
0 commit comments