From 76d6649f3685ee1f958a9ada7497efd09beb5e4f Mon Sep 17 00:00:00 2001 From: Muthiyahsundaram Nagaprabhu Date: Tue, 26 Nov 2019 12:36:09 -0800 Subject: [PATCH] New image versions :: AL2 2.0 & Standard 3.0 --- al2/x86_64/standard/2.0/Dockerfile | 530 ++++++++++++++++ al2/x86_64/standard/2.0/dockerd-entrypoint.sh | 23 + al2/x86_64/standard/2.0/runtimes.yml | 101 +++ al2/x86_64/standard/2.0/ssh_config | 3 + .../2.0/tools/android-accept-licenses.sh | 30 + ubuntu/standard/3.0/Dockerfile | 580 ++++++++++++++++++ ubuntu/standard/3.0/dockerd-entrypoint.sh | 23 + ubuntu/standard/3.0/runtimes.yml | 102 +++ ubuntu/standard/3.0/ssh_config | 3 + .../3.0/tools/android-accept-licenses.sh | 30 + 10 files changed, 1425 insertions(+) create mode 100644 al2/x86_64/standard/2.0/Dockerfile create mode 100755 al2/x86_64/standard/2.0/dockerd-entrypoint.sh create mode 100644 al2/x86_64/standard/2.0/runtimes.yml create mode 100644 al2/x86_64/standard/2.0/ssh_config create mode 100755 al2/x86_64/standard/2.0/tools/android-accept-licenses.sh create mode 100644 ubuntu/standard/3.0/Dockerfile create mode 100755 ubuntu/standard/3.0/dockerd-entrypoint.sh create mode 100644 ubuntu/standard/3.0/runtimes.yml create mode 100644 ubuntu/standard/3.0/ssh_config create mode 100755 ubuntu/standard/3.0/tools/android-accept-licenses.sh diff --git a/al2/x86_64/standard/2.0/Dockerfile b/al2/x86_64/standard/2.0/Dockerfile new file mode 100644 index 00000000..f31b1dfd --- /dev/null +++ b/al2/x86_64/standard/2.0/Dockerfile @@ -0,0 +1,530 @@ +FROM amazonlinux:2 + +ENV RUBY_VERSION="2.6.4" \ + PYTHON_VERSION="3.8.0" \ + PHP_VERSION=7.3.9 \ + JAVA_VERSION=11 \ + NODE_12_VERSION="12.13.0" \ + NODE_10_VERSION="10.17.0" \ + GOLANG_13_VERSION="1.13.4" \ + GOLANG_12_VERSION="1.12.13" \ + DOTNET_SDK_VERSION="3.0.100" \ + DOCKER_VERSION="19.03.1" \ + DOCKER_COMPOSE_VERSION="1.24.0" + +ARG CHINA_REGION + +#**************** Utilities ********************************************* +ENV DOCKER_BUCKET="download.docker.com" \ + DOCKER_CHANNEL="stable" \ + DOCKER_SHA256="6e7d8e24ee46b13d7547d751696d01607d19c8224c1b2c867acc8c779e77734b" \ + DIND_COMMIT="3b5fac462d21ca164b3778647420016315289034" \ + GITVERSION_VERSION="4.0.0" \ + DEBIAN_FRONTEND="noninteractive" \ + SRC_DIR="/usr/src" \ + EPEL_REPO="https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm" + +# Install git, SSH, and other utilities +RUN set -ex \ + && yum install -y openssh-clients \ + && mkdir ~/.ssh \ + && touch ~/.ssh/known_hosts \ + && ssh-keyscan -t rsa,dsa -H github.com >> ~/.ssh/known_hosts \ + && ssh-keyscan -t rsa,dsa -H bitbucket.org >> ~/.ssh/known_hosts \ + && chmod 600 ~/.ssh/known_hosts \ + && yum install -y $EPEL_REPO \ + && rpm --import https://download.mono-project.com/repo/xamarin.gpg \ + && curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo \ + && amazon-linux-extras enable corretto8 \ + && yum groupinstall -y "Development tools" \ + && yum install -y wget fakeroot jq \ + bzr mercurial procps-ng \ + ImageMagick \ + openssl-devel libdb-devel \ + libevent-devel libffi-devel GeoIP-devel glib2-devel \ + libjpeg-devel krb5-server xz-devel \ + mariadb-devel \ + ncurses-devel postgresql-devel readline-devel \ + libsqlite3x-devel libwebp-devel \ + libxml2-devel libxslt-devel libyaml-devel \ + e2fsprogs iptables xfsprogs \ + mono-devel groff \ + asciidoc cvs cvsps docbook-dtds docbook-style-xsl \ + perl-DBD-SQLite perl-DBI perl-HTTP-Date \ + perl-IO-Pty-Easy libserf subversion-perl tcl perl-TimeDate \ + perl-YAML-LibYAML bzrtools python-configobj \ + sgml-common xmlto libxslt \ + tk xorg-x11-server-Xvfb expect parallel rsync + +# Install Docker +RUN set -ex \ + && curl -fSL "https://${DOCKER_BUCKET}/linux/static/${DOCKER_CHANNEL}/x86_64/docker-${DOCKER_VERSION}.tgz" -o docker.tgz \ + && echo "${DOCKER_SHA256} *docker.tgz" | sha256sum -c - \ + && tar --extract --file docker.tgz --strip-components 1 --directory /usr/local/bin/ \ + && rm docker.tgz \ + && docker -v \ +# set up subuid/subgid so that "--userns-remap=default" works out-of-the-box + && groupadd dockremap \ + && useradd -g dockremap dockremap \ + && echo 'dockremap:165536:65536' >> /etc/subuid \ + && echo 'dockremap:165536:65536' >> /etc/subgid \ + && wget "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind" -O /usr/local/bin/dind \ + && curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Linux-x86_64 > /usr/local/bin/docker-compose \ + && chmod +x /usr/local/bin/dind /usr/local/bin/docker-compose \ +# Ensure docker-compose works + && docker-compose version + +# 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 +RUN curl -sS -o /usr/local/bin/aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/bin/linux/amd64/aws-iam-authenticator \ + && curl -sS -o /usr/local/bin/kubectl https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/bin/linux/amd64/kubectl \ + && curl -sS -o /usr/local/bin/ecs-cli https://s3.amazonaws.com/amazon-ecs-cli/ecs-cli-linux-amd64-latest \ + && chmod +x /usr/local/bin/kubectl /usr/local/bin/aws-iam-authenticator /usr/local/bin/ecs-cli + +VOLUME /var/lib/docker + +# Configure SSH +COPY ssh_config /root/.ssh/config + +COPY runtimes.yml /codebuild/image/config/runtimes.yml + +COPY dockerd-entrypoint.sh /usr/local/bin/ + +#**************** RUBY ********************************************************* + +ENV RBENV_SRC_DIR="/usr/local/rbenv" + +ENV PATH="/root/.rbenv/shims:$RBENV_SRC_DIR/bin:$RBENV_SRC_DIR/shims:$PATH" \ + RUBY_BUILD_SRC_DIR="$RBENV_SRC_DIR/plugins/ruby-build" + +RUN set -ex \ + && git clone https://github.com/rbenv/rbenv.git $RBENV_SRC_DIR \ + && mkdir -p $RBENV_SRC_DIR/plugins \ + && git clone https://github.com/rbenv/ruby-build.git $RUBY_BUILD_SRC_DIR \ + && sh $RUBY_BUILD_SRC_DIR/install.sh \ + && rbenv install $RUBY_VERSION && rbenv global $RUBY_VERSION \ + && ruby -v + +#**************** END RUBY ***************************************************** + +#**************** PYTHON ********************************************* +ENV PATH="/usr/local/bin:$PATH" \ + GPG_KEY="E3FF2839C048B25C084DEBE9B26995E310250568" \ + PYTHON_PIP_VERSION="19.1.1" \ + LC_ALL=C.UTF-8 \ + LANG=C.UTF-8 + +RUN yum install -y tcl-devel tk-devel bzip2-devel gdbm-devel libuuid-devel \ + && wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ + && wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ + && export GNUPGHOME="$(mktemp -d)" \ + && (gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$GPG_KEY" \ + || gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys "$GPG_KEY" \ + || gpg --keyserver pgp.mit.edu --recv-keys "$GPG_KEY") \ + && gpg --batch --verify python.tar.xz.asc python.tar.xz \ + && rm -r "$GNUPGHOME" python.tar.xz.asc \ + && mkdir -p /usr/src/python \ + && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ + && rm python.tar.xz \ + \ + && cd /usr/src/python \ + && ./configure \ + --enable-loadable-sqlite-extensions \ + --enable-shared \ + && make -j$(nproc) \ + && make install \ + && ln -s /usr/local/lib/libpython3.8.so.1.0 /usr/lib/libpython3.8.so.1.0 \ + && ldconfig \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ + && pip install pipenv virtualenv --no-cache-dir \ + && pip3 install --no-cache-dir --upgrade setuptools wheel \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ + && find /usr/local -depth \ + \( \ + \( -type d -a -name test -o -name tests \) \ + -o \ + \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ + \) -exec rm -rf '{}' + \ + && rm -rf /usr/src/python ~/.cache \ + && cd /usr/local/bin \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ + && ln -s idle3 idle \ + && ln -s pydoc3 pydoc \ + && ln -s python3 python \ + && ln -s python3-config python-config \ + && rm -fr /tmp/* /var/tmp/* +#**************** END PYTHON ********************************************* + +ENV PATH="/root/.local/bin:$PATH" + +RUN set -ex \ + && pip3 install --user aws-sam-cli \ + && sam --version \ + && pip3 install awscli boto3 + +#**************** PHP **************************************************** + ENV GPG_KEYS CBAF69F173A0FEA4B537F470D66C9593118BCCB6 F38252826ACD957EF380D39F2F7956BC5DA04B5D + ENV PHP_DOWNLOAD_SHA="4007f24a39822bef2805b75c625551d30be9eeed329d52eb0838fa5c1b91c1fd" \ + PHPPATH="/php" \ + PHP_INI_DIR="/usr/local/etc/php" \ + PHP_CFLAGS="-fstack-protector -fpic -fpie -O2" \ + PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" + ENV PHP_SRC_DIR="$SRC_DIR/php" \ + PHP_CPPFLAGS="$PHP_CFLAGS" \ + PHP_URL="https://secure.php.net/get/php-$PHP_VERSION.tar.xz/from/this/mirror" \ + PHP_ASC_URL="https://secure.php.net/get/php-$PHP_VERSION.tar.xz.asc/from/this/mirror" + RUN set -xe; \ + mkdir -p $SRC_DIR; \ + cd $SRC_DIR; \ + yum install -y curl-devel; \ + wget -O php.tar.xz "$PHP_URL"; \ + echo "$PHP_DOWNLOAD_SHA *php.tar.xz" | sha256sum -c -; \ + wget -O php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + ( gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" \ + || gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys "$key" \ + || gpg --keyserver pgp.mit.edu --recv-keys "$key" ); \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + rm -rf "$GNUPGHOME"; \ + set -eux; \ + yum install -y libedit-devel dpkg-dev libargon2-devel re2c; \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ + ; \ + mkdir -p $PHP_SRC_DIR; \ + tar -Jxf $SRC_DIR/php.tar.xz -C $PHP_SRC_DIR --strip-components=1; \ + cd $PHP_SRC_DIR; \ + gnuArch="$(dpkg-architecture -qDEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture -qDEB_BUILD_MULTIARCH)"; \ + if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi; \ + ./configure \ + --build="$gnuArch" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + --disable-cgi \ + # --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) + --enable-ftp \ + # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ + # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ + --enable-sockets \ + --enable-pcntl \ + # https://wiki.php.net/rfc/argon2_password_hash (7.2+) + --with-password-argon2 \ + --with-curl \ + --with-pdo-pgsql \ + --with-pdo-mysql \ + --with-libedit \ + --with-openssl \ + --with-zlib \ + $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ + --with-libdir="lib/$debMultiarch" \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + rm -rf $PHP_SRC_DIR; \ + rm $SRC_DIR/php.tar.xz; \ + php --version; \ + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ + mkdir "$PHP_INI_DIR"; \ + mkdir "$PHP_INI_DIR/conf.d"; \ + touch "$PHP_INI_DIR/conf.d/memory.ini" \ + && echo "memory_limit = 1G;" >> "$PHP_INI_DIR/conf.d/memory.ini"; + + ENV PATH="$PHPPATH/bin:/usr/local/php/bin:$PATH" + + # Install Composer globally + RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer +#**************** END PHP **************************************************** + +#**************** 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 \ + && n $NODE_10_VERSION && npm install --save-dev -g grunt && npm install --save-dev -g grunt-cli && npm install --save-dev -g webpack \ + && n $NODE_12_VERSION && npm install --save-dev -g grunt && npm install --save-dev -g grunt-cli && npm install --save-dev -g 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 yarn \ + && yarn --version \ + && cd / && rm -rf $N_SRC_DIR; + +#**************** END NODEJS **************************************************** + +#**************** JAVA **************************************************** +# Copy install tools +COPY tools /opt/tools + +ENV JAVA_11_HOME="/opt/jvm/amazon-corretto-11" \ + JDK_11_HOME="/opt/jvm/amazon-corretto-11" \ + JRE_11_HOME="/opt/jvm/amazon-corretto-11" \ + JAVA_8_HOME="/usr/lib/jvm/java-1.8.0-amazon-corretto.x86_64" \ + JDK_8_HOME="/usr/lib/jvm/java-1.8.0-amazon-corretto.x86_64" \ + JRE_8_HOME="/usr/lib/jvm/java-1.8.0-amazon-corretto.x86_64/jre" \ + ANT_VERSION=1.10.6 \ + MAVEN_HOME="/opt/maven" \ + MAVEN_VERSION=3.6.1 \ + MAVEN_CONFIG="/root/.m2" \ + INSTALLED_GRADLE_VERSIONS="4.10.3 5.4.1" \ + GRADLE_VERSION=5.4.1 \ + SBT_VERSION=1.2.8 \ + JDK_VERSION=11.0.4.11.1 \ + ANDROID_HOME="/usr/local/android-sdk-linux" \ + GRADLE_PATH="$SRC_DIR/gradle" \ + ANDROID_SDK_MANAGER_VER="4333796" \ + ANDROID_SDK_BUILD_TOOLS="build-tools;29.0.2" \ + ANDROID_SDK_PLATFORM_TOOLS="platforms;android-29" \ + ANDROID_SDK_BUILD_TOOLS_28="build-tools;28.0.3" \ + ANDROID_SDK_PLATFORM_TOOLS_28="platforms;android-28" \ + ANDROID_SDK_EXTRAS="extras;android;m2repository extras;google;m2repository extras;google;google_play_services" \ + JDK_DOWNLOAD_SHA256="aaf35f707ea12f5942c72ba70192444de19c4e1c7f5546ce2a0725093dde6fba" \ + ANT_DOWNLOAD_SHA512="c1a9694c3018e248000ff6f46d48af85f537ef3935e0d5256543c58a240084c0aff5289fd9e94cbc40d5442f3cc43592398047f2548fded40d9882be2b40750d" \ + MAVEN_DOWNLOAD_SHA512="b4880fb7a3d81edd190a029440cdf17f308621af68475a4fe976296e71ff4a4b546dd6d8a58aaafba334d309cc11e638c52808a4b0e818fc0fd544226d952544" \ + GRADLE_DOWNLOADS_SHA256="14cd15fc8cc8705bd69dcfa3c8fefb27eb7027f5de4b47a8b279218f76895a91 5.4.1\n336b6898b491f6334502d8074a6b8c2d73ed83b92123106bd4bf837f04111043 4.10.3" \ + ANDROID_SDK_MANAGER_SHA256="92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9" + +ENV JDK_DOWNLOAD_TAR="amazon-corretto-${JDK_VERSION}-linux-x64.tar.gz" \ + JAVA_HOME="$JAVA_11_HOME" \ + JDK_HOME="$JDK_11_HOME" \ + JRE_HOME="$JRE_11_HOME" + +ENV JDK_DOWNLOAD_URL="https://d3pxv6yz143wms.cloudfront.net/${JDK_VERSION}/${JDK_DOWNLOAD_TAR}" \ + PATH="${PATH}:/opt/tools:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools" + +RUN set -ex \ + # Install Amazon Corretto 8 + && yum install -y java-1.8.0-amazon-corretto-devel \ + # Ensure Java cacerts symlink points to valid location + && update-ca-trust \ + # Install Android SDK manager + && wget "https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_MANAGER_VER}.zip" -O /tmp/android-sdkmanager.zip \ + && echo "${ANDROID_SDK_MANAGER_SHA256} /tmp/android-sdkmanager.zip" | sha256sum -c - \ + && mkdir -p ${ANDROID_HOME} \ + && unzip /tmp/android-sdkmanager.zip -d ${ANDROID_HOME} \ + && chown -R root.root ${ANDROID_HOME} \ + && ln -s ${ANDROID_HOME}/tools/android /usr/bin/android \ + # Install Android + && android-accept-licenses.sh "env JAVA_HOME=$JAVA_8_HOME JRE_HOME=$JRE_8_HOME JDK_HOME=$JDK_8_HOME sdkmanager --verbose platform-tools ${ANDROID_SDK_BUILD_TOOLS} ${ANDROID_SDK_PLATFORM_TOOLS} ${ANDROID_SDK_EXTRAS} ${ANDROID_SDK_NDK_TOOLS}" \ + && android-accept-licenses.sh "env JAVA_HOME=$JAVA_8_HOME JRE_HOME=$JRE_8_HOME JDK_HOME=$JDK_8_HOME sdkmanager --verbose platform-tools ${ANDROID_SDK_BUILD_TOOLS_28} ${ANDROID_SDK_PLATFORM_TOOLS_28}" \ + && android-accept-licenses.sh "env JAVA_HOME=$JAVA_8_HOME JRE_HOME=$JRE_8_HOME JDK_HOME=$JDK_8_HOME sdkmanager --licenses" \ + # Install Amazon Corretto 11 + # Note: We will use update-alternatives to make sure JDK11 has higher priority for all the tools + && mkdir -p $JAVA_HOME \ + && curl -LSso /var/tmp/$JDK_DOWNLOAD_TAR $JDK_DOWNLOAD_URL \ + && echo "$JDK_DOWNLOAD_SHA256 /var/tmp/$JDK_DOWNLOAD_TAR" | sha256sum -c - \ + && tar xzvf /var/tmp/$JDK_DOWNLOAD_TAR -C $JAVA_HOME --strip-components=1 \ + && for tool_path in $JAVA_HOME/bin/*; do \ + tool=`basename $tool_path`; \ + update-alternatives --install /usr/bin/$tool $tool $tool_path 10000; \ + update-alternatives --set $tool $tool_path; \ + done \ + && rm $JAVA_HOME/lib/security/cacerts && ln -s /etc/pki/java/cacerts $JAVA_HOME/lib/security/cacerts \ + # Install Ant + && curl -LSso /var/tmp/apache-ant-$ANT_VERSION-bin.tar.gz https://archive.apache.org/dist/ant/binaries/apache-ant-$ANT_VERSION-bin.tar.gz \ + && echo "$ANT_DOWNLOAD_SHA512 /var/tmp/apache-ant-$ANT_VERSION-bin.tar.gz" | sha512sum -c - \ + && tar -xzf /var/tmp/apache-ant-$ANT_VERSION-bin.tar.gz -C /opt \ + && update-alternatives --install /usr/bin/ant ant /opt/apache-ant-$ANT_VERSION/bin/ant 10000 \ + # Install Maven + && mkdir -p $MAVEN_HOME \ + && curl -LSso /var/tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz https://apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \ + && echo "$MAVEN_DOWNLOAD_SHA512 /var/tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz" | sha512sum -c - \ + && tar xzvf /var/tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz -C $MAVEN_HOME --strip-components=1 \ + && update-alternatives --install /usr/bin/mvn mvn /opt/maven/bin/mvn 10000 \ + && mkdir -p $MAVEN_CONFIG \ + # Install Gradle + && mkdir -p $GRADLE_PATH \ + && for version in $INSTALLED_GRADLE_VERSIONS; do { \ + wget "https://services.gradle.org/distributions/gradle-$version-all.zip" -O "$GRADLE_PATH/gradle-$version-all.zip" \ + && unzip "$GRADLE_PATH/gradle-$version-all.zip" -d /usr/local \ + && echo -e "$GRADLE_DOWNLOADS_SHA256" | grep "$version" | sed "s|$version|$GRADLE_PATH/gradle-$version-all.zip|" | sha256sum -c - \ + && mkdir "/tmp/gradle-$version" \ + && "/usr/local/gradle-$version/bin/gradle" -p "/tmp/gradle-$version" wrapper \ + # Android Studio uses the "-all" distribution for it's wrapper script. + && perl -pi -e "s/gradle-$version-bin.zip/gradle-$version-all.zip/" "/tmp/gradle-$version/gradle/wrapper/gradle-wrapper.properties" \ + && "/tmp/gradle-$version/gradlew" -p "/tmp/gradle-$version" init \ + && rm -rf "/tmp/gradle-$version" \ + && if [ "$version" != "$GRADLE_VERSION" ]; then rm -rf "/usr/local/gradle-$version"; fi; \ + }; done \ + # Install default GRADLE_VERSION to path + && ln -s /usr/local/gradle-$GRADLE_VERSION/bin/gradle /usr/bin/gradle \ + && rm -rf $GRADLE_PATH \ + # Install SBT + && wget https://dl.bintray.com/sbt/rpm/sbt-$SBT_VERSION.rpm \ + && yum install -y sbt-$SBT_VERSION.rpm \ + && rm -fr sbt-$SBT_VERSION.rpm \ + # Cleanup + && rm -fr /tmp/* /var/tmp/* +#**************** END JAVA **************************************************** + +#**************** GO (latest 1.13) ********************************************************** +ENV GOLANG_DOWNLOAD_SHA256="692d17071736f74be04a72a06dab9cac1cd759377bd85316e52b2227604c004c" \ + GOPATH="/go" \ + DEP_VERSION="0.5.1" \ + DEP_BINARY="dep-linux-amd64" + +RUN set -ex \ + && mkdir -p "$GOPATH/src" "$GOPATH/bin" \ + && chmod -R 777 "$GOPATH" \ + && wget "https://dl.google.com/go/go$GOLANG_13_VERSION.linux-amd64.tar.gz" -O /tmp/golang.tar.gz \ + && echo "$GOLANG_DOWNLOAD_SHA256 /tmp/golang.tar.gz" | sha256sum -c - \ + && tar -xzf /tmp/golang.tar.gz -C /tmp \ + && mv /tmp/go /usr/local/go13 \ + && rm -fr /tmp/* /var/tmp/* \ + && wget "https://github.com/golang/dep/releases/download/v$DEP_VERSION/$DEP_BINARY" -O "$GOPATH/bin/dep" \ + && chmod +x "$GOPATH/bin/dep" + +RUN ln -s /usr/local/go13 /usr/local/go + +ENV PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" + +#*************** GO 1.12 ************************************************* + +ENV GOLANG_12_DOWNLOAD_SHA256="da036454cb3353f9f507f0ceed4048feac611065e4e1818b434365eb32ac9bdc" + +RUN set -ex \ + && wget "https://dl.google.com/go/go$GOLANG_12_VERSION.linux-amd64.tar.gz" -O /tmp/golang.tar.gz \ + && echo "$GOLANG_12_DOWNLOAD_SHA256 /tmp/golang.tar.gz" | sha256sum -c - \ + && tar -xzf /tmp/golang.tar.gz -C /tmp \ + && mv /tmp/go /usr/local/go12 \ + && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/* + +#**************** END GO ********************************************************** + +#**************** .NET-CORE ******************************************************* +# Install .NET Core SDK +ENV DOTNET_SDK_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz +ENV DOTNET_SDK_DOWNLOAD_SHA 766da31f9a0bcfbf0f12c91ea68354eb509ac2111879d55b656f19299c6ea1c005d31460dac7c2a4ef82b3edfea30232c82ba301fb52c0ff268d3e3a1b73d8f7 + + +RUN set -ex \ + && curl -SL $DOTNET_SDK_DOWNLOAD_URL --output dotnet.tar.gz \ + && echo "$DOTNET_SDK_DOWNLOAD_SHA dotnet.tar.gz" | sha512sum -c - \ + && mkdir -p /usr/share/dotnet \ + && tar -zxf dotnet.tar.gz -C /usr/share/dotnet \ + && rm dotnet.tar.gz \ + && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet + +# Add .NET Core Global Tools install folder to PATH +ENV PATH "~/.dotnet/tools/:$PATH" + +# Trigger the population of the local package cache +ENV NUGET_XMLDOC_MODE skip +RUN set -ex \ + && mkdir warmup \ + && cd warmup \ + && dotnet new \ + && cd .. \ + && rm -rf warmup \ + && rm -rf /tmp/NuGetScratch + +# Install Powershell Core +# See instructions at https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-powershell-core-on-linux +ENV POWERSHELL_VERSION 6.2.1 +ENV POWERSHELL_DOWNLOAD_URL https://github.com/PowerShell/PowerShell/releases/download/v$POWERSHELL_VERSION/powershell-$POWERSHELL_VERSION-linux-x64.tar.gz +ENV POWERSHELL_DOWNLOAD_SHA E8287687C99162BF70FEFCC2E492F3B54F80BE880D86B9A0EC92C71B05C40013 + +RUN set -ex \ + && curl -SL $POWERSHELL_DOWNLOAD_URL --output powershell.tar.gz \ + && echo "$POWERSHELL_DOWNLOAD_SHA powershell.tar.gz" | sha256sum -c - \ + && mkdir -p /opt/microsoft/powershell/$POWERSHELL_VERSION \ + && tar zxf powershell.tar.gz -C /opt/microsoft/powershell/$POWERSHELL_VERSION \ + && rm powershell.tar.gz \ + && ln -s /opt/microsoft/powershell/$POWERSHELL_VERSION/pwsh /usr/bin/pwsh +#**************** END .NET-CORE ******************************************************* + +# Download and set up GitVersion +ENV LIBGIT2_PKG="https://rpmfind.net/linux/centos/7/extras/x86_64/Packages/libgit2-0.26.6-1.el7.x86_64.rpm" + +RUN set -ex \ + && yum install -y $LIBGIT2_PKG \ + && wget "https://github.com/GitTools/GitVersion/releases/download/v${GITVERSION_VERSION}/GitVersion-bin-coreclr-v${GITVERSION_VERSION}.zip" -O /tmp/GitVersion_${GITVERSION_VERSION}.zip \ + && mkdir -p /usr/local/GitVersion_${GITVERSION_VERSION} \ + && unzip /tmp/GitVersion_${GITVERSION_VERSION}.zip -d /usr/local/GitVersion_${GITVERSION_VERSION} \ + && rm /tmp/GitVersion_${GITVERSION_VERSION}.zip \ + && ln -s /usr/lib64/libgit2.so.0.26.6 /usr/lib64/libgit2-15e1193.so \ + && echo "dotnet /usr/local/GitVersion_${GITVERSION_VERSION}/GitVersion.dll \$@" >> /usr/local/bin/gitversion \ + && chmod +x /usr/local/bin/gitversion + +#**************** HEADLESS BROWSERS ******************************************************* +# Install Firefox + +RUN set -ex \ + && yum install -y gtk3-devel dbus-glib-devel \ + && wget -O ~/FirefoxSetup.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64" \ + && tar xjf ~/FirefoxSetup.tar.bz2 -C /opt/ \ + && ln -s /opt/firefox/firefox /usr/local/bin/firefox \ + && rm ~/FirefoxSetup.tar.bz2 \ + && firefox --version + +# Install GeckoDriver + +RUN set -ex \ + && curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest | grep browser_download_url | grep linux64.tar.gz | cut -d : -f 2,3 | tr -d ' "' | wget -O /tmp/geckodriver-latest-linux64.tar.gz -qi - \ + && tar -xzf /tmp/geckodriver-latest-linux64.tar.gz -C /opt \ + && rm /tmp/geckodriver-latest-linux64.tar.gz \ + && chmod 755 /opt/geckodriver \ + && ln -s /opt/geckodriver /usr/bin/geckodriver \ + && geckodriver --version + +# Install Chromium +RUN set -ex \ + && yum install -y chromium + +# Install ChromeDriver + +RUN set -ex \ + && CHROME_VERSION=`chromium-browser --version | awk -F '[ .]' '{print $2"."$3"."$4}'` \ + && CHROME_DRIVER_VERSION=`wget -qO- chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_VERSION` \ + && wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip \ + && unzip /tmp/chromedriver_linux64.zip -d /opt \ + && rm /tmp/chromedriver_linux64.zip \ + && mv /opt/chromedriver /opt/chromedriver-$CHROME_DRIVER_VERSION \ + && chmod 755 /opt/chromedriver-$CHROME_DRIVER_VERSION \ + && ln -s /opt/chromedriver-$CHROME_DRIVER_VERSION /usr/bin/chromedriver \ + && chromedriver --version + +# Cleanup +RUN set -ex \ + && yum clean all + + +RUN set -ex \ + && yum install -y openssl \ + && curl -o stunnel-5.55.tar.gz https://www.stunnel.org/downloads/stunnel-5.55.tar.gz \ + && tar xvfz stunnel-5.55.tar.gz \ + && cd stunnel-5.55 \ + && ./configure \ + && make \ + && make install \ + && openssl genrsa -out key.pem 2048 \ + && 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" \ + && cat key.pem cert.pem >> /usr/local/etc/stunnel/stunnel.pem \ + && cd .. ; rm -rf stunnel-5.55* \ + && yum clean all + +ENTRYPOINT ["dockerd-entrypoint.sh"] diff --git a/al2/x86_64/standard/2.0/dockerd-entrypoint.sh b/al2/x86_64/standard/2.0/dockerd-entrypoint.sh new file mode 100755 index 00000000..1591be44 --- /dev/null +++ b/al2/x86_64/standard/2.0/dockerd-entrypoint.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -e + +/usr/local/bin/dockerd \ + --host=unix:///var/run/docker.sock \ + --host=tcp://127.0.0.1:2375 \ + --storage-driver=overlay2 &>/var/log/docker.log & + + +tries=0 +d_timeout=60 +until docker info >/dev/null 2>&1 +do + if [ "$tries" -gt "$d_timeout" ]; then + cat /var/log/docker.log + echo 'Timed out trying to connect to internal docker host.' >&2 + exit 1 + fi + tries=$(( $tries + 1 )) + sleep 1 +done + +eval "$@" diff --git a/al2/x86_64/standard/2.0/runtimes.yml b/al2/x86_64/standard/2.0/runtimes.yml new file mode 100644 index 00000000..5f18a706 --- /dev/null +++ b/al2/x86_64/standard/2.0/runtimes.yml @@ -0,0 +1,101 @@ +version: 0.1 + +runtimes: + android: + versions: + 28: + requires: + java: ["corretto8"] + commands: + - echo "Installing Android version 28 ..." + 29: + requires: + java: ["corretto8"] + commands: + - echo "Installing Android version 29 ..." + java: + versions: + corretto11: + commands: + - echo "Installing corretto(OpenJDK) version 11 ..." + + - export JAVA_HOME="$JAVA_11_HOME" + + - export JRE_HOME="$JRE_11_HOME" + + - export JDK_HOME="$JDK_11_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 + corretto8: + commands: + - echo "Installing corretto(OpenJDK) version 8 ..." + + - export JAVA_HOME="$JAVA_8_HOME" + + - export JRE_HOME="$JRE_8_HOME" + + - export JDK_HOME="$JDK_8_HOME" + + - |- + for tool_path in "$JAVA_8_HOME"/bin/* "$JRE_8_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 + golang: + versions: + 1.12: + commands: + - echo "Installing Go version 1.12 ..." + - rm -rf /usr/local/go + - ln -s /usr/local/go12 /usr/local/go + 1.13: + commands: + - echo "Installing Go version 1.13 ..." + python: + versions: + 3.8: + commands: + - echo "Installing Python version 3.8 ..." + php: + versions: + 7.3: + commands: + - echo "Installing PHP version 7.3 ..." + ruby: + versions: + 2.6: + commands: + - echo "Installing Ruby version 2.6 ..." + - rbenv global 2.6.4 + nodejs: + versions: + 12: + commands: + - echo "Installing Node.js version 12 ..." + - n 12.13.0 + 10: + commands: + - echo "Installing Node.js version 10 ..." + - n 10.17.0 + docker: + versions: + 18: + commands: + - echo "Specifying docker version in buildspec is deprecated. Using docker $DOCKER_VERSION ." + dotnet: + versions: + 3.0: + commands: + - echo "Installing .NET version 3.0 ..." diff --git a/al2/x86_64/standard/2.0/ssh_config b/al2/x86_64/standard/2.0/ssh_config new file mode 100644 index 00000000..710e2754 --- /dev/null +++ b/al2/x86_64/standard/2.0/ssh_config @@ -0,0 +1,3 @@ +Host * + ConnectTimeout 10 + ConnectionAttempts 10 diff --git a/al2/x86_64/standard/2.0/tools/android-accept-licenses.sh b/al2/x86_64/standard/2.0/tools/android-accept-licenses.sh new file mode 100755 index 00000000..ebac067f --- /dev/null +++ b/al2/x86_64/standard/2.0/tools/android-accept-licenses.sh @@ -0,0 +1,30 @@ +#!/usr/bin/expect -f + +set timeout 1800 +set cmd [lindex $argv 0] +set licenses [lindex $argv 1] + +spawn {*}$cmd +expect { + "Do you accept the license '*'*" { + exp_send "y\r" + exp_continue + } + "Accept? (y/N): " { + exp_send "y\r" + exp_continue + } + "Review licenses that have not been accepted (y/N)? " { + exp_send "y\r" + exp_continue + } + eof +} + +lassign [wait] pid spawnid os_error waitvalue + +if {$os_error == 0} { + exit $waitvalue +} else { + exit 1 +} diff --git a/ubuntu/standard/3.0/Dockerfile b/ubuntu/standard/3.0/Dockerfile new file mode 100644 index 00000000..58f7609b --- /dev/null +++ b/ubuntu/standard/3.0/Dockerfile @@ -0,0 +1,580 @@ +FROM ubuntu:18.04 + +ENV RUBY_VERSION="2.6.4" \ + PYTHON_VERSION="3.8.0" \ + PHP_VERSION=7.3.9 \ + JAVA_VERSION=11 \ + NODE_12_VERSION="12.13.0" \ + NODE_10_VERSION="10.17.0" \ + GOLANG_VERSION="1.13.4" \ + GOLANG_12_VERSION="1.12.13" \ + DOTNET_SDK_VERSION="3.0.100" \ + DOCKER_VERSION="19.03.1" \ + DOCKER_COMPOSE_VERSION="1.24.0" + +ARG CHINA_REGION + +#**************** Utilities ********************************************* +ENV DOCKER_BUCKET="download.docker.com" \ + DOCKER_CHANNEL="stable" \ + DOCKER_SHA256="6e7d8e24ee46b13d7547d751696d01607d19c8224c1b2c867acc8c779e77734b" \ + DIND_COMMIT="3b5fac462d21ca164b3778647420016315289034" \ + GITVERSION_VERSION="4.0.0" \ + DEBIAN_FRONTEND="noninteractive" \ + SRC_DIR="/usr/src" + + +# Install git, SSH, and other utilities +RUN set -ex \ + && echo 'Acquire::CompressionTypes::Order:: "gz";' > /etc/apt/apt.conf.d/99use-gzip-compression \ + && apt-get update \ + && apt install -y apt-transport-https gnupg ca-certificates \ + && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \ + && echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | tee /etc/apt/sources.list.d/mono-official-stable.list \ + && apt-get update \ + && apt-get install software-properties-common -y --no-install-recommends \ + && apt-add-repository -y ppa:git-core/ppa \ + && apt-get update \ + && apt-get install git=1:2.* -y --no-install-recommends \ + && git version \ + && apt-get install -y --no-install-recommends openssh-client \ + && mkdir ~/.ssh \ + && touch ~/.ssh/known_hosts \ + && ssh-keyscan -t rsa,dsa -H github.com >> ~/.ssh/known_hosts \ + && ssh-keyscan -t rsa,dsa -H bitbucket.org >> ~/.ssh/known_hosts \ + && chmod 600 ~/.ssh/known_hosts \ + && apt-get install -y --no-install-recommends \ + wget python3 python3-dev python3-pip python3-setuptools fakeroot jq \ + netbase dirmngr bzr mercurial procps \ + tar gzip zip autoconf automake \ + bzip2 file g++ gcc imagemagick \ + libbz2-dev libc6-dev libcurl4-openssl-dev libdb-dev \ + libevent-dev libffi-dev libgeoip-dev libglib2.0-dev \ + libjpeg-dev libkrb5-dev liblzma-dev \ + libmagickcore-dev libmagickwand-dev libmysqlclient-dev \ + libncurses5-dev libpq-dev libreadline-dev \ + libsqlite3-dev libssl-dev libtool libwebp-dev \ + libxml2-dev libxslt1-dev libyaml-dev make \ + patch xz-utils zlib1g-dev unzip curl \ + e2fsprogs iptables xfsprogs \ + mono-devel less groff liberror-perl \ + asciidoc build-essential bzr cvs cvsps docbook-xml docbook-xsl dpkg-dev \ + libdbd-sqlite3-perl libdbi-perl libdpkg-perl libhttp-date-perl \ + libio-pty-perl libserf-1-1 libsvn-perl libsvn1 libtcl8.6 libtimedate-perl \ + libxml2-utils libyaml-perl python-bzrlib python-configobj \ + sgml-base sgml-data subversion tcl tcl8.6 xml-core xmlto xsltproc \ + tk gettext gettext-base libapr1 libaprutil1 xvfb expect parallel \ + locales rsync \ + && rm -rf /var/lib/apt/lists/* \ + && apt-get clean + +# Download and set up GitVersion +RUN set -ex \ + && wget "https://github.com/GitTools/GitVersion/releases/download/v${GITVERSION_VERSION}/GitVersion-bin-net40-v${GITVERSION_VERSION}.zip" -O /tmp/GitVersion_${GITVERSION_VERSION}.zip \ + && mkdir -p /usr/local/GitVersion_${GITVERSION_VERSION} \ + && unzip /tmp/GitVersion_${GITVERSION_VERSION}.zip -d /usr/local/GitVersion_${GITVERSION_VERSION} \ + && rm /tmp/GitVersion_${GITVERSION_VERSION}.zip \ + && echo "mono /usr/local/GitVersion_${GITVERSION_VERSION}/GitVersion.exe \$@" >> /usr/local/bin/gitversion \ + && chmod +x /usr/local/bin/gitversion + +# Install Docker +RUN set -ex \ + && curl -fSL "https://${DOCKER_BUCKET}/linux/static/${DOCKER_CHANNEL}/x86_64/docker-${DOCKER_VERSION}.tgz" -o docker.tgz \ + && echo "${DOCKER_SHA256} *docker.tgz" | sha256sum -c - \ + && tar --extract --file docker.tgz --strip-components 1 --directory /usr/local/bin/ \ + && rm docker.tgz \ + && docker -v \ +# set up subuid/subgid so that "--userns-remap=default" works out-of-the-box + && addgroup dockremap \ + && useradd -g dockremap dockremap \ + && echo 'dockremap:165536:65536' >> /etc/subuid \ + && echo 'dockremap:165536:65536' >> /etc/subgid \ + && wget "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind" -O /usr/local/bin/dind \ + && curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Linux-x86_64 > /usr/local/bin/docker-compose \ + && chmod +x /usr/local/bin/dind /usr/local/bin/docker-compose \ +# Ensure docker-compose works + && docker-compose version + +# 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 +RUN curl -sS -o /usr/local/bin/aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/bin/linux/amd64/aws-iam-authenticator \ + && curl -sS -o /usr/local/bin/kubectl https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/bin/linux/amd64/kubectl \ + && curl -sS -o /usr/local/bin/ecs-cli https://s3.amazonaws.com/amazon-ecs-cli/ecs-cli-linux-amd64-latest \ + && chmod +x /usr/local/bin/kubectl /usr/local/bin/aws-iam-authenticator /usr/local/bin/ecs-cli + +RUN set -ex \ + && pip3 install awscli boto3 + +VOLUME /var/lib/docker + +# Configure SSH +COPY ssh_config /root/.ssh/config + +COPY runtimes.yml /codebuild/image/config/runtimes.yml + +COPY dockerd-entrypoint.sh /usr/local/bin/ + +#**************** RUBY ********************************************************* + +ENV RBENV_SRC_DIR="/usr/local/rbenv" + +ENV PATH="/root/.rbenv/shims:$RBENV_SRC_DIR/bin:$RBENV_SRC_DIR/shims:$PATH" \ + RUBY_BUILD_SRC_DIR="$RBENV_SRC_DIR/plugins/ruby-build" + +RUN set -ex \ + && git clone https://github.com/rbenv/rbenv.git $RBENV_SRC_DIR \ + && mkdir -p $RBENV_SRC_DIR/plugins \ + && git clone https://github.com/rbenv/ruby-build.git $RUBY_BUILD_SRC_DIR \ + && sh $RUBY_BUILD_SRC_DIR/install.sh \ + && rbenv install $RUBY_VERSION && rbenv global $RUBY_VERSION + +#**************** END RUBY ***************************************************** + +#**************** PYTHON ********************************************* +ENV PATH="/usr/local/bin:$PATH" \ + GPG_KEY="E3FF2839C048B25C084DEBE9B26995E310250568" \ + PYTHON_PIP_VERSION="19.1.1" \ + LC_ALL=C.UTF-8 \ + LANG=C.UTF-8 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + tcl-dev tk-dev \ + && rm -rf /var/lib/apt/lists/* \ + && wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" && \ + wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ + && export GNUPGHOME="$(mktemp -d)" \ + && (gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$GPG_KEY" \ + || gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys "$GPG_KEY" \ + || gpg --keyserver pgp.mit.edu --recv-keys "$GPG_KEY") \ + && gpg --batch --verify python.tar.xz.asc python.tar.xz \ + && rm -rf "$GNUPGHOME" python.tar.xz.asc \ + && mkdir -p /usr/src/python \ + && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ + && rm python.tar.xz \ + \ + && cd /usr/src/python \ + && ./configure \ + --enable-loadable-sqlite-extensions \ + --enable-shared \ + && make -j$(nproc) \ + && make install \ + && ldconfig \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ + && pip install pipenv virtualenv --no-cache-dir \ + && pip3 install --no-cache-dir --upgrade setuptools wheel \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ + && find /usr/local -depth \ + \( \ + \( -type d -a -name test -o -name tests \) \ + -o \ + \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ + \) -exec rm -rf '{}' + \ + && apt-get purge -y --auto-remove tcl-dev tk-dev \ + && rm -rf /usr/src/python ~/.cache \ + && cd /usr/local/bin \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ + && ln -s idle3 idle \ + && ln -s pydoc3 pydoc \ + && ln -s python3 python \ + && ln -s python3-config python-config \ + && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/* +#**************** END PYTHON ********************************************* + +#**************** PHP **************************************************** + ENV GPG_KEYS CBAF69F173A0FEA4B537F470D66C9593118BCCB6 F38252826ACD957EF380D39F2F7956BC5DA04B5D + ENV PHP_DOWNLOAD_SHA="4007f24a39822bef2805b75c625551d30be9eeed329d52eb0838fa5c1b91c1fd" \ + PHPPATH="/php" \ + PHP_INI_DIR="/usr/local/etc/php" \ + PHP_CFLAGS="-fstack-protector -fpic -fpie -O2" \ + PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" + ENV PHP_SRC_DIR="$SRC_DIR/php" \ + PHP_CPPFLAGS="$PHP_CFLAGS" \ + PHP_URL="https://secure.php.net/get/php-$PHP_VERSION.tar.xz/from/this/mirror" \ + PHP_ASC_URL="https://secure.php.net/get/php-$PHP_VERSION.tar.xz.asc/from/this/mirror" + RUN set -xe; \ + mkdir -p $SRC_DIR; \ + cd $SRC_DIR; \ + wget -O php.tar.xz "$PHP_URL"; \ + echo "$PHP_DOWNLOAD_SHA *php.tar.xz" | sha256sum -c -; \ + wget -O php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + ( gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" \ + || gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys "$key" \ + || gpg --keyserver pgp.mit.edu --recv-keys "$key" ); \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + rm -rf "$GNUPGHOME"; \ + set -eux; \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends libedit-dev dpkg-dev libargon2-0-dev; \ + rm -rf /var/lib/apt/lists/*; \ + apt-get clean; \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ + ; \ + mkdir -p $PHP_SRC_DIR; \ + tar -Jxf $SRC_DIR/php.tar.xz -C $PHP_SRC_DIR --strip-components=1; \ + cd $PHP_SRC_DIR; \ + gnuArch="$(dpkg-architecture -qDEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture -qDEB_BUILD_MULTIARCH)"; \ + if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi; \ + ./configure \ + --build="$gnuArch" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + --disable-cgi \ + # --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) + --enable-ftp \ + # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ + # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ + --enable-sockets \ + --enable-pcntl \ + # https://wiki.php.net/rfc/argon2_password_hash (7.2+) + --with-password-argon2 \ + --with-curl \ + --with-pdo-pgsql \ + --with-pdo-mysql \ + --with-libedit \ + --with-openssl \ + --with-zlib \ + $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ + --with-libdir="lib/$debMultiarch" \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + cd /; \ + rm -rf $PHP_SRC_DIR; \ + rm $SRC_DIR/php.tar.xz; \ + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + php --version; \ + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ + mkdir "$PHP_INI_DIR"; \ + mkdir "$PHP_INI_DIR/conf.d"; \ + touch "$PHP_INI_DIR/conf.d/memory.ini" \ + && echo "memory_limit = 1G;" >> "$PHP_INI_DIR/conf.d/memory.ini"; + + ENV PATH="$PHPPATH/bin:/usr/local/php/bin:$PATH" + + # Install Composer globally + RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer +#**************** END PHP **************************************************** + +#**************** 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 \ + && n $NODE_10_VERSION && npm install --save-dev -g grunt && npm install --save-dev -g grunt-cli && npm install --save-dev -g webpack \ + && n $NODE_12_VERSION && npm install --save-dev -g grunt && npm install --save-dev -g grunt-cli && npm install --save-dev -g webpack \ + && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ + && apt-get update && apt-get install -y --no-install-recommends yarn \ + && cd / && rm -rf $N_SRC_DIR; + +#**************** END NODEJS **************************************************** + +#**************** JAVA **************************************************** +# Copy install tools +COPY tools /opt/tools + +ENV JAVA_11_HOME="/opt/jvm/openjdk-11" \ + JDK_11_HOME="/opt/jvm/openjdk-11" \ + JRE_11_HOME="/opt/jvm/openjdk-11" \ + JAVA_8_HOME="/usr/lib/jvm/java-8-openjdk-amd64" \ + JDK_8_HOME="/usr/lib/jvm/java-8-openjdk-amd64" \ + JRE_8_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre" \ + ANT_VERSION=1.10.6 \ + MAVEN_HOME="/opt/maven" \ + MAVEN_VERSION=3.6.1 \ + MAVEN_CONFIG="/root/.m2" \ + INSTALLED_GRADLE_VERSIONS="4.10.3 5.4.1" \ + GRADLE_VERSION=5.4.1 \ + SBT_VERSION=1.2.8 \ + JDK_VERSION=11.0.2 \ + JDK_VERSION_TAG=9 \ + ANDROID_HOME="/usr/local/android-sdk-linux" \ + GRADLE_PATH="$SRC_DIR/gradle" \ + ANDROID_SDK_MANAGER_VER="4333796" \ + ANDROID_SDK_BUILD_TOOLS="build-tools;29.0.2" \ + ANDROID_SDK_PLATFORM_TOOLS="platforms;android-29" \ + ANDROID_SDK_BUILD_TOOLS_28="build-tools;28.0.3" \ + ANDROID_SDK_PLATFORM_TOOLS_28="platforms;android-28" \ + ANDROID_SDK_EXTRAS="extras;android;m2repository extras;google;m2repository extras;google;google_play_services" \ + JDK_DOWNLOAD_SHA256="99be79935354f5c0df1ad293620ea36d13f48ec3ea870c838f20c504c9668b57" \ + ANT_DOWNLOAD_SHA512="c1a9694c3018e248000ff6f46d48af85f537ef3935e0d5256543c58a240084c0aff5289fd9e94cbc40d5442f3cc43592398047f2548fded40d9882be2b40750d" \ + MAVEN_DOWNLOAD_SHA512="b4880fb7a3d81edd190a029440cdf17f308621af68475a4fe976296e71ff4a4b546dd6d8a58aaafba334d309cc11e638c52808a4b0e818fc0fd544226d952544" \ + GRADLE_DOWNLOADS_SHA256="14cd15fc8cc8705bd69dcfa3c8fefb27eb7027f5de4b47a8b279218f76895a91 5.4.1\n336b6898b491f6334502d8074a6b8c2d73ed83b92123106bd4bf837f04111043 4.10.3" \ + ANDROID_SDK_MANAGER_SHA256="92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9" + +ENV JDK_DOWNLOAD_TAR="openjdk-${JDK_VERSION}_linux-x64_bin.tar.gz" \ + JAVA_HOME="$JAVA_11_HOME" \ + JDK_HOME="$JDK_11_HOME" \ + JRE_HOME="$JRE_11_HOME" + +ENV PATH="${PATH}:/opt/tools:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools" + +RUN set -ex \ + && apt-get update \ + && apt-get install -y software-properties-common \ + # Install OpenJDK 8 + && add-apt-repository -y ppa:openjdk-r/ppa \ + && apt-get update \ + && apt-get install -y openjdk-8-jdk \ + && apt-get install -y --no-install-recommends ca-certificates-java \ + # Ensure Java cacerts symlink points to valid location + && update-ca-certificates -f \ + && dpkg --add-architecture i386 \ + && apt-get update \ + && apt-get install -y --force-yes libc6-i386 \ + lib32stdc++6 lib32gcc1 lib32ncurses5 \ + lib32z1 libqt5widgets5 \ + # Install Android SDK manager + && wget "https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_MANAGER_VER}.zip" -O /tmp/android-sdkmanager.zip \ + && echo "${ANDROID_SDK_MANAGER_SHA256} /tmp/android-sdkmanager.zip" | sha256sum -c - \ + && mkdir -p ${ANDROID_HOME} \ + && unzip /tmp/android-sdkmanager.zip -d ${ANDROID_HOME} \ + && chown -R root.root ${ANDROID_HOME} \ + && ln -s ${ANDROID_HOME}/tools/android /usr/bin/android \ + # Install Android + && android-accept-licenses.sh "env JAVA_HOME=$JAVA_8_HOME JRE_HOME=$JRE_8_HOME JDK_HOME=$JDK_8_HOME sdkmanager --verbose platform-tools ${ANDROID_SDK_BUILD_TOOLS} ${ANDROID_SDK_PLATFORM_TOOLS} ${ANDROID_SDK_EXTRAS} ${ANDROID_SDK_NDK_TOOLS}" \ + && android-accept-licenses.sh "env JAVA_HOME=$JAVA_8_HOME JRE_HOME=$JRE_8_HOME JDK_HOME=$JDK_8_HOME sdkmanager --verbose platform-tools ${ANDROID_SDK_BUILD_TOOLS_28} ${ANDROID_SDK_PLATFORM_TOOLS_28}" \ + && android-accept-licenses.sh "env JAVA_HOME=$JAVA_8_HOME JRE_HOME=$JRE_8_HOME JDK_HOME=$JDK_8_HOME sdkmanager --licenses" \ + && apt-get install -y python-setuptools \ + # Install OpenJDK 11 + # Note: We will use update-alternatives to make sure JDK11 has higher priority for all the tools + && mkdir -p $JAVA_HOME \ + && curl -LSso /var/tmp/$JDK_DOWNLOAD_TAR https://download.java.net/java/GA/jdk$JAVA_VERSION/$JDK_VERSION_TAG/GPL/$JDK_DOWNLOAD_TAR \ + && echo "$JDK_DOWNLOAD_SHA256 /var/tmp/$JDK_DOWNLOAD_TAR" | sha256sum -c - \ + && tar xzvf /var/tmp/$JDK_DOWNLOAD_TAR -C $JAVA_HOME --strip-components=1 \ + && for tool_path in $JAVA_HOME/bin/*; do \ + tool=`basename $tool_path`; \ + update-alternatives --install /usr/bin/$tool $tool $tool_path 10000; \ + update-alternatives --set $tool $tool_path; \ + done \ + && rm $JAVA_HOME/lib/security/cacerts && ln -s /etc/ssl/certs/java/cacerts $JAVA_HOME/lib/security/cacerts \ + # Install Ant + && curl -LSso /var/tmp/apache-ant-$ANT_VERSION-bin.tar.gz https://archive.apache.org/dist/ant/binaries/apache-ant-$ANT_VERSION-bin.tar.gz \ + && echo "$ANT_DOWNLOAD_SHA512 /var/tmp/apache-ant-$ANT_VERSION-bin.tar.gz" | sha512sum -c - \ + && tar -xzf /var/tmp/apache-ant-$ANT_VERSION-bin.tar.gz -C /opt \ + && update-alternatives --install /usr/bin/ant ant /opt/apache-ant-$ANT_VERSION/bin/ant 10000 \ + # Install Maven + && mkdir -p $MAVEN_HOME \ + && curl -LSso /var/tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz https://apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \ + && echo "$MAVEN_DOWNLOAD_SHA512 /var/tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz" | sha512sum -c - \ + && tar xzvf /var/tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz -C $MAVEN_HOME --strip-components=1 \ + && update-alternatives --install /usr/bin/mvn mvn /opt/maven/bin/mvn 10000 \ + && mkdir -p $MAVEN_CONFIG \ + # Install Gradle + && mkdir -p $GRADLE_PATH \ + && for version in $INSTALLED_GRADLE_VERSIONS; do { \ + wget "https://services.gradle.org/distributions/gradle-$version-all.zip" -O "$GRADLE_PATH/gradle-$version-all.zip" \ + && unzip "$GRADLE_PATH/gradle-$version-all.zip" -d /usr/local \ + && echo "$GRADLE_DOWNLOADS_SHA256" | grep "$version" | sed "s|$version|$GRADLE_PATH/gradle-$version-all.zip|" | sha256sum -c - \ + && mkdir "/tmp/gradle-$version" \ + && "/usr/local/gradle-$version/bin/gradle" -p "/tmp/gradle-$version" wrapper \ + # Android Studio uses the "-all" distribution for it's wrapper script. + && perl -pi -e "s/gradle-$version-bin.zip/gradle-$version-all.zip/" "/tmp/gradle-$version/gradle/wrapper/gradle-wrapper.properties" \ + && "/tmp/gradle-$version/gradlew" -p "/tmp/gradle-$version" init \ + && rm -rf "/tmp/gradle-$version" \ + && if [ "$version" != "$GRADLE_VERSION" ]; then rm -rf "/usr/local/gradle-$version"; fi; \ + }; done \ + # Install default GRADLE_VERSION to path + && ln -s /usr/local/gradle-$GRADLE_VERSION/bin/gradle /usr/bin/gradle \ + && rm -rf $GRADLE_PATH \ + # Install SBT + && echo "deb https://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list \ + && apt-get install -y --no-install-recommends apt-transport-https \ + && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823 \ + && apt-get update \ + && apt-get install -y --no-install-recommends sbt=$SBT_VERSION \ + # Cleanup + && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && apt-get clean +#**************** END JAVA **************************************************** + +#**************** GO (latest 1.13) ********************************************************** +ENV GOLANG_DOWNLOAD_SHA256="692d17071736f74be04a72a06dab9cac1cd759377bd85316e52b2227604c004c" \ + GOPATH="/go" \ + DEP_VERSION="0.5.1" \ + DEP_BINARY="dep-linux-amd64" + +RUN set -ex \ + && mkdir -p "$GOPATH/src" "$GOPATH/bin" \ + && chmod -R 777 "$GOPATH" \ + && apt-get update && apt-get install -y --no-install-recommends \ + pkg-config \ + && apt-get clean \ + && wget "https://dl.google.com/go/go$GOLANG_VERSION.linux-amd64.tar.gz" -O /tmp/golang.tar.gz \ + && echo "$GOLANG_DOWNLOAD_SHA256 /tmp/golang.tar.gz" | sha256sum -c - \ + && tar -xzf /tmp/golang.tar.gz -C /tmp \ + && mv /tmp/go /usr/local/go13 \ + && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && wget "https://github.com/golang/dep/releases/download/v$DEP_VERSION/$DEP_BINARY" -O "$GOPATH/bin/dep" \ + && chmod +x "$GOPATH/bin/dep" + +RUN ln -s /usr/local/go13 /usr/local/go + +ENV PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" + +#*************** GO 1.12 ************************************************* + +ENV GOLANG_12_DOWNLOAD_SHA256="da036454cb3353f9f507f0ceed4048feac611065e4e1818b434365eb32ac9bdc" + +RUN set -ex \ + && wget "https://dl.google.com/go/go$GOLANG_12_VERSION.linux-amd64.tar.gz" -O /tmp/golang.tar.gz \ + && echo "$GOLANG_12_DOWNLOAD_SHA256 /tmp/golang.tar.gz" | sha256sum -c - \ + && tar -xzf /tmp/golang.tar.gz -C /tmp \ + && mv /tmp/go /usr/local/go12 \ + && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/* + +#**************** END GO ********************************************************** + +#**************** .NET-CORE ******************************************************* +RUN set -ex \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + libc6 \ + libgcc1 \ + libgssapi-krb5-2 \ + liblttng-ust0 \ + libstdc++6 \ + zlib1g \ + software-properties-common \ + && add-apt-repository ppa:ubuntu-toolchain-r/test -y \ + && apt-get update \ + && rm -rf /var/lib/apt/lists/* + +# Install .NET Core SDK +ENV DOTNET_SDK_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz +ENV DOTNET_SDK_DOWNLOAD_SHA 766da31f9a0bcfbf0f12c91ea68354eb509ac2111879d55b656f19299c6ea1c005d31460dac7c2a4ef82b3edfea30232c82ba301fb52c0ff268d3e3a1b73d8f7 + +RUN set -ex \ + && curl -SL $DOTNET_SDK_DOWNLOAD_URL --output dotnet.tar.gz \ + && echo "$DOTNET_SDK_DOWNLOAD_SHA dotnet.tar.gz" | sha512sum -c - \ + && mkdir -p /usr/share/dotnet \ + && tar -zxf dotnet.tar.gz -C /usr/share/dotnet \ + && rm dotnet.tar.gz \ + && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet + +# Add .NET Core Global Tools install folder to PATH +ENV PATH "~/.dotnet/tools/:$PATH" + +# Trigger the population of the local package cache +ENV NUGET_XMLDOC_MODE skip +RUN set -ex \ + && mkdir warmup \ + && cd warmup \ + && dotnet new \ + && cd .. \ + && rm -rf warmup \ + && rm -rf /tmp/NuGetScratch + +# Install Powershell Core +# See instructions at https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-powershell-core-on-linux +ARG POWERSHELL_VERSION=6.2.1 +ENV POWERSHELL_DOWNLOAD_URL https://github.com/PowerShell/PowerShell/releases/download/v$POWERSHELL_VERSION/powershell-$POWERSHELL_VERSION-linux-x64.tar.gz +ENV POWERSHELL_DOWNLOAD_SHA E8287687C99162BF70FEFCC2E492F3B54F80BE880D86B9A0EC92C71B05C40013 + +RUN set -ex \ + && curl -SL $POWERSHELL_DOWNLOAD_URL --output powershell.tar.gz \ + && echo "$POWERSHELL_DOWNLOAD_SHA powershell.tar.gz" | sha256sum -c - \ + && mkdir -p /opt/microsoft/powershell/$POWERSHELL_VERSION \ + && tar zxf powershell.tar.gz -C /opt/microsoft/powershell/$POWERSHELL_VERSION \ + && rm powershell.tar.gz \ + && ln -s /opt/microsoft/powershell/$POWERSHELL_VERSION/pwsh /usr/bin/pwsh +#**************** END .NET-CORE ******************************************************* + +#**************** HEADLESS BROWSERS ******************************************************* +# Install Firefox + +RUN set -ex \ + && apt-add-repository -y "deb http://archive.canonical.com/ubuntu $(lsb_release -sc) partner" \ + && apt-add-repository -y ppa:malteworld/ppa && apt-get update \ + && apt-get install -y libgtk-3-0 libglib2.0-0 libdbus-glib-1-2 libdbus-1-3 libasound2 \ + && wget -O ~/FirefoxSetup.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64" \ + && tar xjf ~/FirefoxSetup.tar.bz2 -C /opt/ \ + && ln -s /opt/firefox/firefox /usr/local/bin/firefox \ + && rm ~/FirefoxSetup.tar.bz2 \ + && firefox --version + +# Install GeckoDriver + +RUN set -ex \ + && curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest | grep browser_download_url | grep linux64.tar.gz | cut -d : -f 2,3 | tr -d ' "' | wget -O /tmp/geckodriver-latest-linux64.tar.gz -qi - \ + && tar -xzf /tmp/geckodriver-latest-linux64.tar.gz -C /opt \ + && rm /tmp/geckodriver-latest-linux64.tar.gz \ + && chmod 755 /opt/geckodriver \ + && ln -s /opt/geckodriver /usr/bin/geckodriver \ + && geckodriver --version + +# Install Chrome + +RUN set -ex \ + && curl --silent --show-error --location --fail --retry 3 --output /tmp/google-chrome-stable_current_amd64.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ + && (dpkg -i /tmp/google-chrome-stable_current_amd64.deb || apt-get -fy install) \ + && rm -rf /tmp/google-chrome-stable_current_amd64.deb \ + && sed -i 's|HERE/chrome"|HERE/chrome" --disable-setuid-sandbox --no-sandbox|g' "/opt/google/chrome/google-chrome" \ + && google-chrome --version + +# Install ChromeDriver + +RUN set -ex \ + && CHROME_VERSION=`google-chrome --version | awk -F '[ .]' '{print $3"."$4"."$5}'` \ + && CHROME_DRIVER_VERSION=`wget -qO- chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_VERSION` \ + && wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip \ + && unzip /tmp/chromedriver_linux64.zip -d /opt \ + && rm /tmp/chromedriver_linux64.zip \ + && mv /opt/chromedriver /opt/chromedriver-$CHROME_DRIVER_VERSION \ + && chmod 755 /opt/chromedriver-$CHROME_DRIVER_VERSION \ + && ln -s /opt/chromedriver-$CHROME_DRIVER_VERSION /usr/bin/chromedriver \ + && chromedriver --version + +RUN set -ex \ + && apt-get install -y openssl \ + && curl -o stunnel-5.55.tar.gz https://www.stunnel.org/downloads/stunnel-5.55.tar.gz \ + && tar xvfz stunnel-5.55.tar.gz \ + && cd stunnel-5.55 \ + && ./configure \ + && make \ + && make install \ + && openssl genrsa -out key.pem 2048 \ + && 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" \ + && cat key.pem cert.pem >> /usr/local/etc/stunnel/stunnel.pem \ + && cd .. ; rm -rf stunnel-5.55* \ + && apt-get clean + +ENTRYPOINT ["dockerd-entrypoint.sh"] diff --git a/ubuntu/standard/3.0/dockerd-entrypoint.sh b/ubuntu/standard/3.0/dockerd-entrypoint.sh new file mode 100755 index 00000000..1591be44 --- /dev/null +++ b/ubuntu/standard/3.0/dockerd-entrypoint.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -e + +/usr/local/bin/dockerd \ + --host=unix:///var/run/docker.sock \ + --host=tcp://127.0.0.1:2375 \ + --storage-driver=overlay2 &>/var/log/docker.log & + + +tries=0 +d_timeout=60 +until docker info >/dev/null 2>&1 +do + if [ "$tries" -gt "$d_timeout" ]; then + cat /var/log/docker.log + echo 'Timed out trying to connect to internal docker host.' >&2 + exit 1 + fi + tries=$(( $tries + 1 )) + sleep 1 +done + +eval "$@" diff --git a/ubuntu/standard/3.0/runtimes.yml b/ubuntu/standard/3.0/runtimes.yml new file mode 100644 index 00000000..8b82a36c --- /dev/null +++ b/ubuntu/standard/3.0/runtimes.yml @@ -0,0 +1,102 @@ +version: 0.1 + +runtimes: + android: + versions: + 28: + requires: + java: ["openjdk8"] + commands: + - echo "Installing Android version 28 ..." + 29: + requires: + java: ["openjdk8"] + commands: + - echo "Installing Android version 29 ..." + + java: + versions: + openjdk11: + commands: + - echo "Installing Java version 11 ..." + + - export JAVA_HOME="$JAVA_11_HOME" + + - export JRE_HOME="$JRE_11_HOME" + + - export JDK_HOME="$JDK_11_HOME" + + - |- + for tool_path in "$JAVA_HOME"/bin/*; + do tool=`basename "$tool_path"`; + if [ $tool != 'java-rmi.cgi' ]; + then + update-alternatives --list "$tool" | grep -q "$tool_path" \ + && update-alternatives --set "$tool" "$tool_path"; + fi; + done + openjdk8: + commands: + - echo "Installing Java version 8 ..." + + - export JAVA_HOME="$JAVA_8_HOME" + + - export JRE_HOME="$JRE_8_HOME" + + - export JDK_HOME="$JDK_8_HOME" + + - |- + for tool_path in "$JAVA_8_HOME"/bin/* "$JRE_8_HOME"/bin/*; + do tool=`basename "$tool_path"`; + if [ $tool != 'java-rmi.cgi' ]; + then + update-alternatives --list "$tool" | grep -q "$tool_path" \ + && update-alternatives --set "$tool" "$tool_path"; + fi; + done + golang: + versions: + 1.12: + commands: + - echo "Installing Go version 1.12 ..." + - rm -rf /usr/local/go + - ln -s /usr/local/go12 /usr/local/go + 1.13: + commands: + - echo "Installing Go version 1.13 ..." + python: + versions: + 3.8: + commands: + - echo "Installing Python version 3.8 ..." + php: + versions: + 7.3: + commands: + - echo "Installing PHP version 7.3 ..." + ruby: + versions: + 2.6: + commands: + - echo "Installing Ruby version 2.6 ..." + - rbenv global 2.6.4 + nodejs: + versions: + 10: + commands: + - echo "Installing Node.js version 10 ..." + - n 10.17.0 + 12: + commands: + - echo "Installing Node.js version 12 ..." + - n 12.13.0 + docker: + versions: + 18: + commands: + - echo "Specifying docker version in buildspec is deprecated. Using docker $DOCKER_VERSION ." + dotnet: + versions: + 3.0: + commands: + - echo "Installing .NET version 3.0 ..." diff --git a/ubuntu/standard/3.0/ssh_config b/ubuntu/standard/3.0/ssh_config new file mode 100644 index 00000000..710e2754 --- /dev/null +++ b/ubuntu/standard/3.0/ssh_config @@ -0,0 +1,3 @@ +Host * + ConnectTimeout 10 + ConnectionAttempts 10 diff --git a/ubuntu/standard/3.0/tools/android-accept-licenses.sh b/ubuntu/standard/3.0/tools/android-accept-licenses.sh new file mode 100755 index 00000000..ebac067f --- /dev/null +++ b/ubuntu/standard/3.0/tools/android-accept-licenses.sh @@ -0,0 +1,30 @@ +#!/usr/bin/expect -f + +set timeout 1800 +set cmd [lindex $argv 0] +set licenses [lindex $argv 1] + +spawn {*}$cmd +expect { + "Do you accept the license '*'*" { + exp_send "y\r" + exp_continue + } + "Accept? (y/N): " { + exp_send "y\r" + exp_continue + } + "Review licenses that have not been accepted (y/N)? " { + exp_send "y\r" + exp_continue + } + eof +} + +lassign [wait] pid spawnid os_error waitvalue + +if {$os_error == 0} { + exit $waitvalue +} else { + exit 1 +}