Skip to content

Commit

Permalink
Merge pull request #689 from Dylan-AWS/master
Browse files Browse the repository at this point in the history
Update Ubuntu standard 7 and AL(x86) standard 5 with latest runtimes,…
  • Loading branch information
awszhen authored Dec 14, 2023
2 parents 894ac16 + 6f89e32 commit 13e354f
Show file tree
Hide file tree
Showing 13 changed files with 308 additions and 110 deletions.
119 changes: 81 additions & 38 deletions al2/x86_64/standard/5.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RUN set -ex \
perl-DBI perl-HTTP-Date perl-TimeDate perl-YAML-LibYAML \
postgresql-devel procps-ng python-configobj readline-devel rsync sgml-common \
subversion-perl tar tcl tk vim wget which xfsprogs xmlto xorg-x11-server-Xvfb xz-devel \
amazon-ecr-credential-helper \
amazon-ecr-credential-helper git-lfs \
&& rm /etc/yum.repos.d/mono-centos7-stable.repo

RUN useradd codebuild-user
Expand All @@ -45,9 +45,17 @@ RUN useradd codebuild-user

FROM core AS tools

# Install AWS SAM CLI
RUN wget -nv https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip -O /tmp/samcli.zip \
&& unzip -q /tmp/samcli.zip -d /opt \
&& /opt/install --update -i /usr/local/sam-cli -b /usr/local/bin \
&& rm /tmp/samcli.zip /opt/install \
&& rm -rf /opt/aws-sam-cli-src \
&& sam --version

# Install Git
RUN set -ex \
&& GIT_VERSION=2.40.1 \
&& GIT_VERSION=2.42.1 \
&& GIT_TAR_FILE=git-$GIT_VERSION.tar.gz \
&& GIT_SRC=https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz \
&& curl -L -o $GIT_TAR_FILE $GIT_SRC \
Expand All @@ -60,9 +68,9 @@ RUN set -ex \

# Install stunnel
RUN set -ex \
&& STUNNEL_VERSION=5.69 \
&& STUNNEL_VERSION=5.71 \
&& STUNNEL_TAR=stunnel-$STUNNEL_VERSION.tar.gz \
&& STUNNEL_SHA256="1ff7d9f30884c75b98c8a0a4e1534fa79adcada2322635e6787337b4e38fdb81" \
&& STUNNEL_SHA256="f023aae837c2d32deb920831a5ee1081e11c78a5d57340f8e6f0829f031017f5" \
&& curl -o $STUNNEL_TAR https://www.stunnel.org/archive/5.x/$STUNNEL_TAR && echo "$STUNNEL_SHA256 $STUNNEL_TAR" | sha256sum --check && tar xfz $STUNNEL_TAR \
&& cd stunnel-$STUNNEL_VERSION \
&& ./configure \
Expand Down Expand Up @@ -92,11 +100,6 @@ RUN set -ex \
&& wget -qO /usr/local/bin/dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
&& chmod +x /usr/local/bin/dotnet-install.sh

##nodejs
ENV N_SRC_DIR="$SRC_DIR/n"
RUN git clone https://github.com/tj/n $N_SRC_DIR \
&& cd $N_SRC_DIR && make install

##ruby
ENV RBENV_SRC_DIR="/usr/local/rbenv"

Expand All @@ -110,7 +113,7 @@ RUN set -ex \
&& sh $RUBY_BUILD_SRC_DIR/install.sh

##python
RUN curl https://pyenv.run | bash
RUN curl -s -S -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
ENV PATH="/root/.pyenv/shims:/root/.pyenv/bin:$PATH"

##php
Expand All @@ -132,15 +135,18 @@ FROM tools AS runtimes_1
ENV JAVA_17_HOME="/usr/lib/jvm/java-17-amazon-corretto.x86_64" \
JDK_17_HOME="/usr/lib/jvm/java-17-amazon-corretto.x86_64" \
JRE_17_HOME="/usr/lib/jvm/java-17-amazon-corretto.x86_64" \
ANT_VERSION=1.10.13 \
JAVA_21_HOME="/usr/lib/jvm/java-21-amazon-corretto.x86_64" \
JDK_21_HOME="/usr/lib/jvm/java-21-amazon-corretto.x86_64" \
JRE_21_HOME="/usr/lib/jvm/java-21-amazon-corretto.x86_64" \
ANT_VERSION=1.10.14 \
MAVEN_HOME="/opt/maven" \
MAVEN_VERSION=3.9.2 \
GRADLE_VERSION=8.1.1 \
MAVEN_VERSION=3.9.5 \
GRADLE_VERSION=8.3 \
SBT_VERSION=1.8.3 \
GRADLE_PATH="$SRC_DIR/gradle" \
ANT_DOWNLOAD_SHA512="de4ac604629e39a86a306f0541adb3775596909ad92feb8b7de759b1b286417db24f557228737c8b902d6abf722d2ce5bb0c3baa3640cbeec3481e15ab1958c9" \
MAVEN_DOWNLOAD_SHA512="900bdeeeae550d2d2b3920fe0e00e41b0069f32c019d566465015bdd1b3866395cbe016e22d95d25d51d3a5e614af2c83ec9b282d73309f644859bbad08b63db" \
GRADLE_DOWNLOADS_SHA256="5625a0ae20fe000d9225d000b36909c7a0e0e8dda61c19b12da769add847c975 8.1.1" \
ANT_DOWNLOAD_SHA512="4e74b382dd8271f9eac9fef69ba94751fb8a8356dbd995c4d642f2dad33de77bd37d4001d6c8f4f0ef6789529754968f0c1b6376668033c8904c6ec84543332a" \
MAVEN_DOWNLOAD_SHA512="4810523ba025104106567d8a15a8aa19db35068c8c8be19e30b219a1d7e83bcab96124bf86dc424b1cd3c5edba25d69ec0b31751c136f88975d15406cab3842b" \
GRADLE_DOWNLOADS_SHA256="bb09982fdf52718e4c7b25023d10df6d35a5fff969860bdf5a5bd27a3ab27a9e 8.3" \
SBT_DOWNLOAD_SHA256="21F4210786FD68FD15DCA3F4C8EE9CAE0DB249C54E1B0EF6E829E9FA4936423A"

ARG MAVEN_CONFIG_HOME="/root/.m2"
Expand All @@ -153,6 +159,7 @@ RUN set -x \
&& rpm --import https://yum.corretto.aws/corretto.key \
&& curl -L -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo \
&& yum install -y -q java-17-amazon-corretto java-17-amazon-corretto-devel \
&& yum install -y -q java-21-amazon-corretto-devel \
&& update-ca-trust \
&& for tool_path in $JAVA_HOME/bin/*; do \
tool=`basename $tool_path`; \
Expand Down Expand Up @@ -231,14 +238,23 @@ RUN curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o /tmp/awscli
&& aws --version

#DotNet 6.0
ENV DOTNET_60_SDK_VERSION="6.0.410"
ENV DOTNET_6_SDK_VERSION="6.0.417"
ENV DOTNET_8_SDK_VERSION="8.0.100"
ENV DOTNET_6_GLOBAL_JSON_SDK_VERSION="6.0.0"
ENV DOTNET_8_GLOBAL_JSON_SDK_VERSION="8.0.0"
ENV DOTNET_ROOT="/root/.dotnet"

# Add .NET Core 6.0 Global Tools install folder to PATH
RUN /usr/local/bin/dotnet-install.sh -v $DOTNET_60_SDK_VERSION \
# Add .NET Core 8 Global Tools install folder to PATH
RUN /usr/local/bin/dotnet-install.sh -v $DOTNET_8_SDK_VERSION \
&& dotnet --list-sdks \
&& rm -rf /tmp/*

# Add .NET Core 6.0 Global Tools install folder to PATH
RUN /usr/local/bin/dotnet-install.sh -v $DOTNET_6_SDK_VERSION \
&& dotnet --list-sdks \
&& rm -rf /tmp/* \
&& cd /codebuild && dotnet new globaljson --force --sdk-version $DOTNET_6_GLOBAL_JSON_SDK_VERSION --roll-forward feature

## Trigger the population of the local package cache
ENV NUGET_XMLDOC_MODE skip
RUN set -ex \
Expand All @@ -250,18 +266,25 @@ RUN set -ex \
&& rm -rf /tmp/NuGetScratch
#**************** END Powershell *******************************************************


#**************** NODEJS ****************************************************

ENV NODE_18_VERSION="18.16.0"
ENV N_SRC_DIR="$SRC_DIR/n"
ENV NODE_18_VERSION="18.18.2"
ENV NODE_20_VERSION="20.9.0"

RUN n $NODE_18_VERSION && npm install --save-dev -g -f grunt && npm install --save-dev -g -f grunt-cli && npm install --save-dev -g -f webpack \
&& curl -sSL https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo \
&& rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg \
&& yum install -y https://dl.fedoraproject.org/pub/epel/8/Modular/x86_64/Packages/l/libuv-1.43.0-2.module_el8+13804+34326f90.x86_64.rpm \
&& yum install -y -q yarn \
&& yarn --version \
&& cd / && rm -rf $N_SRC_DIR && rm -rf /tmp/*
RUN git clone https://github.com/tj/n $N_SRC_DIR \
&& cd $N_SRC_DIR && make install

RUN n $NODE_18_VERSION && npm install --save-dev -g -f grunt \
&& npm install --save-dev -g -f grunt-cli \
&& npm install --save-dev -g -f webpack \
&& npm install --save-dev -g -f yarn \
&& n $NODE_20_VERSION && npm install --save-dev -g -f grunt \
&& npm install --save-dev -g -f grunt-cli \
&& npm install --save-dev -g -f webpack \
&& npm install --save-dev -g -f yarn \
&& dnf install -y -v libuv-1.44* \
&& cd / && rm -rf $N_SRC_DIR && rm -rf /tmp/*

#**************** END NODEJS ****************************************************

Expand All @@ -275,24 +298,35 @@ RUN rbenv install $RUBY_32_VERSION && rm -rf /tmp/* && rbenv global $RUBY_32_VER

#**************** PYTHON *****************************************************
#Python 3.11
ENV PYTHON_311_VERSION="3.11.4"
ENV PYTHON_PIP_VERSION=23.1.2
ENV PYTHON_311_VERSION="3.11.6"
ENV PYTHON_312_VERSION="3.12.0"
ENV PYTHON_PIP_VERSION=23.3.1
ENV PYYAML_VERSION=5.4.1

COPY tools/runtime_configs/python/$PYTHON_312_VERSION /root/.pyenv/plugins/python-build/share/python-build/$PYTHON_312_VERSION
RUN env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYTHON_312_VERSION && rm -rf /tmp/*
COPY tools/runtime_configs/python/$PYTHON_311_VERSION /root/.pyenv/plugins/python-build/share/python-build/$PYTHON_311_VERSION
RUN env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYTHON_311_VERSION && rm -rf /tmp/*
RUN pyenv global $PYTHON_311_VERSION
RUN env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYTHON_311_VERSION && rm -rf /tmp/*
RUN set -ex \
&& pyenv global $PYTHON_312_VERSION \
&& pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
&& pip3 install wheel \
&& pip3 install --no-cache-dir --upgrade 'setuptools==67.7.2' boto3 pipenv virtualenv \
&& pip3 install --no-build-isolation "Cython<3" "PyYAML==$PYYAML_VERSION" \
&& pip3 install --no-cache-dir --upgrade 'setuptools==67.7.2' aws-sam-cli boto3 pipenv virtualenv \
&& pip3 uninstall cython --yes

RUN set -ex \
&& pyenv global $PYTHON_311_VERSION \
&& pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
&& pip3 install wheel \
&& pip3 install --no-build-isolation "Cython<3" "PyYAML==$PYYAML_VERSION" \
&& pip3 install --no-cache-dir --upgrade 'setuptools==67.7.2' boto3 pipenv virtualenv \
&& pip3 uninstall cython --yes

#**************** END PYTHON *****************************************************

#**************** PHP ****************************************************
ENV PHP_82_VERSION="8.2.7"
ENV PHP_82_VERSION="8.2.12"

COPY tools/runtime_configs/php/$PHP_82_VERSION /root/.phpenv/plugins/php-build/share/php-build/definitions/$PHP_82_VERSION
RUN phpenv install $PHP_82_VERSION && rm -rf /tmp/* && phpenv global $PHP_82_VERSION
Expand All @@ -303,11 +337,13 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin -
#**************** END PHP ****************************************************

#**************** GOLANG ****************************************************
ENV GOLANG_20_VERSION="1.20.5"
ENV GOLANG_20_VERSION="1.20.11"
ENV GOLANG_21_VERSION="1.21.4"
ENV GOENV_DISABLE_GOPATH=1
ENV GOPATH="/go"

RUN goenv install $GOLANG_20_VERSION && rm -rf /tmp/* && \
goenv install $GOLANG_21_VERSION && rm -rf /tmp/* && \
goenv global $GOLANG_20_VERSION && \
go env -w GO111MODULE=auto

Expand All @@ -321,7 +357,7 @@ FROM runtimes_1 AS runtimes_2
ENV DOCKER_BUCKET="download.docker.com" \
DOCKER_CHANNEL="stable" \
DIND_COMMIT="3b5fac462d21ca164b3778647420016315289034" \
DOCKER_COMPOSE_VERSION="2.17.3" \
DOCKER_COMPOSE_VERSION="2.23.1" \
DOCKER_BUILDX_VERSION="0.11.0"

ENV DOCKER_SHA256="544262F4A3621222AFB79960BFAD4D486935DAB80893478B5CC9CF8EBAF409AE"
Expand Down Expand Up @@ -349,14 +385,13 @@ RUN set -ex \
# Ensure docker-compose and docker compose work
&& docker-compose version \
&& docker compose version \
# Add docker buildx tool \
# Add docker buildx tool
&& curl -L https://github.com/docker/buildx/releases/download/v${DOCKER_BUILDX_VERSION}/buildx-v${DOCKER_BUILDX_VERSION}.linux-amd64 -o /usr/local/lib/docker/cli-plugins/docker-buildx \
&& chmod +x /usr/local/bin/dind /usr/local/lib/docker/cli-plugins/docker-buildx \
&& ln -s /usr/local/lib/docker/cli-plugins/docker-buildx /usr/local/bin/docker-buildx \
# Ensure docker-buildx works
&& docker-buildx version \
&& docker buildx version

#=======================End of layer: runtimes_2 =================
FROM runtimes_2 AS runtimes_3

Expand All @@ -369,6 +404,14 @@ RUN set -ex \
#===================END of runtimes_3 ==============
FROM runtimes_3 AS al2_v5

# Activate runtime versions specific to image version.
RUN n $NODE_18_VERSION
RUN pyenv global $PYTHON_311_VERSION
RUN phpenv global $PHP_82_VERSION
RUN rbenv global $RUBY_32_VERSION
RUN goenv global $GOLANG_20_VERSION
RUN dotnet new globaljson --force --sdk-version $DOTNET_6_GLOBAL_JSON_SDK_VERSION --roll-forward feature

# Configure SSH
COPY ssh_config /root/.ssh/config
COPY runtimes.yml /codebuild/image/config/runtimes.yml
Expand Down
2 changes: 2 additions & 0 deletions al2/x86_64/standard/5.0/legal/bill_of_material.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ fakeroot : GPLv3+ and LGPLv2+ and (GPL+ or Artistic)
----------------
glib2-devel : LGPLv2+
----------------
git-lfs : /usr/share/doc/git-lfs/copyright
----------------
groff : GPLv3+ and GFDL and BSD and MIT
----------------
gtk3-devel : LGPLv2+
Expand Down
42 changes: 39 additions & 3 deletions al2/x86_64/standard/5.0/runtimes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ version: 0.1
runtimes:
java:
versions:
corretto21:
commands:
- echo "Installing corretto(OpenJDK) version 21 ..."

- export JAVA_HOME="$JAVA_21_HOME"

- export JRE_HOME="$JRE_21_HOME"

- export JDK_HOME="$JDK_21_HOME"

- |-
for tool_path in "$JAVA_HOME"/bin/*;
do tool=`basename "$tool_path"`;
if [ $tool != 'java-rmi.cgi' ];
then
rm -f /usr/bin/$tool /var/lib/alternatives/$tool \
&& update-alternatives --install /usr/bin/$tool $tool $tool_path 20000;
fi;
done
corretto17:
commands:
- echo "Installing corretto(OpenJDK) version 17 ..."
Expand All @@ -21,19 +40,27 @@ runtimes:
rm -f /usr/bin/$tool /var/lib/alternatives/$tool \
&& update-alternatives --install /usr/bin/$tool $tool $tool_path 20000;
fi;
done
done
golang:
versions:
1.21:
commands:
- echo "Installing Go version 1.21 ..."
- goenv global $GOLANG_21_VERSION
1.20:
commands:
- echo "Installing Go version 1.20 ..."
- goenv global $GOLANG_20_VERSION
- goenv global $GOLANG_20_VERSION
python:
versions:
3.12:
commands:
- echo "Installing Python version 3.12 ..."
- pyenv global $PYTHON_312_VERSION
3.11:
commands:
- echo "Installing Python version 3.11 ..."
- pyenv global $PYTHON_311_VERSION
- pyenv global $PYTHON_311_VERSION
php:
versions:
8.2:
Expand All @@ -48,12 +75,21 @@ runtimes:
- rbenv global $RUBY_32_VERSION
nodejs:
versions:
20:
commands:
- echo "Installing Node.js version 20 ..."
- n $NODE_20_VERSION
18:
commands:
- echo "Installing Node.js version 18 ..."
- n $NODE_18_VERSION
dotnet:
versions:
8.0:
commands:
- echo "Installing .NET version 8.0 ..."
- test -f "global.json" && echo "Using provided global.json" || dotnet new globaljson --sdk-version $DOTNET_8_GLOBAL_JSON_SDK_VERSION --roll-forward feature
6.0:
commands:
- echo "Installing .NET version 6.0 ..."
- test -f "global.json" && echo "Using provided global.json" || dotnet new globaljson --sdk-version $DOTNET_6_GLOBAL_JSON_SDK_VERSION --roll-forward feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ configure_option "--with-libedit"

PHP_BUILD_EXTRA_MAKE_ARGUMENTS="-j4"

#https://github.com/php-build/php-build/blob/master/share/php-build/definitions/8.2.7
#https://github.com/php-build/php-build/blob/master/share/php-build/definitions/8.2.12
#Don't change beyond this line

configure_option "--enable-gd"
Expand All @@ -15,6 +15,6 @@ configure_option "--with-mhash"

configure_option -D "--with-xmlrpc"

install_package "https://www.php.net/distributions/php-8.2.7.tar.bz2"
install_xdebug "3.2.0"
enable_builtin_opcache
install_package "https://www.php.net/distributions/php-8.2.12.tar.bz2"
install_xdebug "3.2.2"
enable_builtin_opcache
18 changes: 18 additions & 0 deletions al2/x86_64/standard/5.0/tools/runtime_configs/python/3.11.6
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export PYTHON_CONFIGURE_OPTS="\
--enable-shared
--enable-loadable-sqlite-extensions"

# Don't change below this line.
# https://github.com/pyenv/pyenv/blob/master/plugins/python-build/share/python-build/3.11.6

#require_gcc
prefer_openssl11
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
export PYTHON_BUILD_TCLTK_USE_PKGCONFIG=1
install_package "openssl-1.1.1s" "https://www.openssl.org/source/openssl-1.1.1s.tar.gz#c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.2" "https://ftpmirror.gnu.org/readline/readline-8.2.tar.gz#3feb7171f16a84ee82ca18a36d7b9be109a52c04f492a053331d7d1095007c35" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then
install_package "Python-3.11.6" "https://www.python.org/ftp/python/3.11.6/Python-3.11.6.tar.xz#0fab78fa7f133f4f38210c6260d90d7c0d5c7198446419ce057ec7ac2e6f5f38" standard verify_py311 copy_python_gdb ensurepip
else
install_package "Python-3.11.6" "https://www.python.org/ftp/python/3.11.6/Python-3.11.6.tgz#c049bf317e877cbf9fce8c3af902436774ecef5249a29d10984ca3a37f7f4736" standard verify_py311 copy_python_gdb ensurepip
fi
17 changes: 17 additions & 0 deletions al2/x86_64/standard/5.0/tools/runtime_configs/python/3.12.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export PYTHON_CONFIGURE_OPTS="\
--enable-shared
--enable-loadable-sqlite-extensions"

# Don't change below this line.
# https://github.com/pyenv/pyenv/blob/master/plugins/python-build/share/python-build/3.12.0

#require_gcc
prefer_openssl3
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-3.1.2" "https://www.openssl.org/source/openssl-3.1.2.tar.gz#a0ce69b8b97ea6a35b96875235aa453b966ba3cba8af2de23657d8b6767d6539" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.2" "https://ftpmirror.gnu.org/readline/readline-8.2.tar.gz#3feb7171f16a84ee82ca18a36d7b9be109a52c04f492a053331d7d1095007c35" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then
install_package "Python-3.12.0" "https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tar.xz#795c34f44df45a0e9b9710c8c71c15c671871524cd412ca14def212e8ccb155d" standard verify_py312 copy_python_gdb ensurepip
else
install_package "Python-3.12.0" "https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz#51412956d24a1ef7c97f1cb5f70e185c13e3de1f50d131c0aac6338080687afb" standard verify_py312 copy_python_gdb ensurepip
fi
Loading

0 comments on commit 13e354f

Please sign in to comment.