diff --git a/.github/workflows/release-image.yml b/.github/workflows/release-image.yml index 57436f1..cb4c917 100644 --- a/.github/workflows/release-image.yml +++ b/.github/workflows/release-image.yml @@ -75,7 +75,7 @@ jobs: packages: write strategy: matrix: - version: [ '30', '31', '32', '33' ] + version: [ '30', '31', '32', '33', '33-jdk17' ] variant: [ '', '-emulator', '-ndk', '-stf-client' ] needs: [checks-hadolint, checks-shfmt, checks-shellcheck, checks-update] steps: diff --git a/33-jdk17-emulator/Dockerfile b/33-jdk17-emulator/Dockerfile new file mode 100644 index 0000000..e06b563 --- /dev/null +++ b/33-jdk17-emulator/Dockerfile @@ -0,0 +1,119 @@ +FROM ubuntu:focal +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# hadolint ignore=DL3008 +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + expect \ + locales \ + nano \ + openjdk-17-jdk \ + unzip \ + curl \ + xz-utils \ + git \ + && rm -rf /var/lib/apt/lists/* + +# Seems somethings build better with utf8 locale specified +# http://jaredmarkell.com/docker-and-locales/ +# https://github.com/square/moshi/issues/804#issuecomment-466926878 +RUN locale-gen en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US:en +ENV LC_ALL=en_US.UTF-8 + +#### +# hadolint ignore=DL3008 +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + apt-transport-https \ + gnupg \ + lsb-release \ + # For nodejs we use nodesource, its nice and easy and gets us the correct version + # Find latest link https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions + && curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \ + && echo "deb https://deb.nodesource.com/node_18.x $(lsb_release -s -c) main" | tee /etc/apt/sources.list.d/nodesource.list \ + && echo "deb-src https://deb.nodesource.com/node_18.x $(lsb_release -s -c) main" | tee -a /etc/apt/sources.list.d/nodesource.list \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + nodejs \ + && rm -rf /var/lib/apt/lists/* + +# hadolint ignore=DL3016 +RUN npm -g install xcode-build-tools yarn +#### + +# Install the SDK +# https://developer.android.com/studio#downloads +ENV ANDROID_CMDLINE_TOOLS=https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip +# hadolint ignore=DL3003 +RUN ( \ + cd /opt \ + && mkdir android-sdk-linux \ + && curl -sSL -o cmdline-tools.zip "$ANDROID_CMDLINE_TOOLS" \ + && unzip cmdline-tools.zip -d android-sdk-linux/cmdline-tools \ + && rm -f cmdline-tools.zip \ + && chown -R root:root android-sdk-linux \ + ) + +ENV ANDROID_SDK_ROOT=/opt/android-sdk-linux +ENV ANDROID_HOME=$ANDROID_SDK_ROOT +ENV PATH=$ANDROID_HOME/cmdline-tools/cmdline-tools/bin:$ANDROID_HOME/cmdline-tools/tools/bin:$ANDROID_SDK_ROOT/tools/bin:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$PATH + +# Install custom tools +COPY tools/license_accepter /opt/tools/ +COPY tools/adb-all /opt/tools +ENV PATH=/opt/tools:$PATH +RUN license_accepter + +# Install Android platform and things +ENV ANDROID_PLATFORM_VERSION=33 +ENV ANDROID_BUILD_TOOLS_VERSION=33.0.0 +ENV PATH=$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION:$PATH +ENV ANDROID_EXTRA_PACKAGES="build-tools;33.0.0 build-tools;33.0.1 build-tools;33.0.2" +ENV ANDROID_REPOSITORIES="extras;android;m2repository extras;google;m2repository" +ENV ANDROID_CONSTRAINT_PACKAGES="extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2 extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1 extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0" +RUN sdkmanager --verbose "platform-tools" "platforms;android-$ANDROID_PLATFORM_VERSION" "build-tools;$ANDROID_BUILD_TOOLS_VERSION" $ANDROID_EXTRA_PACKAGES $ANDROID_REPOSITORIES $ANDROID_CONSTRAINT_PACKAGES + + +#### +# hadolint ignore=DL3008 +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + file \ + qt5-default \ + libpulse0 \ + && rm -rf /var/lib/apt/lists/* + +ENV ANDROID_EMULATOR_PACKAGE="system-images;android-$ANDROID_PLATFORM_VERSION;google_apis_playstore;x86_64" +RUN sdkmanager --verbose "emulator" $ANDROID_EMULATOR_PACKAGE + +# Fix for emulator detect 64bit +ENV SHELL=/bin/bash +# https://www.bram.us/2017/05/12/launching-the-android-emulator-from-the-command-line/ +ENV PATH=$ANDROID_SDK_ROOT/emulator:$PATH + +COPY tools-emulator/android-start-emulator /opt/tools/ +COPY tools-emulator/android-wait-for-emulator /opt/tools/ +RUN adb keygen ~/.android/adbkey +#### + + +#### +RUN apt-get update \ +&& apt-get -y --no-install-recommends install imagemagick=8:6.9.10.23+dfsg-2.1ubuntu11 \ +&& rm -rf /var/lib/apt/lists/* \ +&& curl -k -0L https://github.com/postmodern/ruby-install/archive/master.tar.gz -o ruby-install.tar.gz \ +&& tar -xzvf ruby-install.tar.gz +WORKDIR /ruby-install-master +RUN apt-get update && apt-get -y --no-install-recommends install make=4.2.1-1.2 \ +&& rm -rf /var/lib/apt/lists/* \ +&& make install +WORKDIR / +RUN apt-get update \ +&& rm -rf ruby-install-master && rm -rf ruby-install.tar.gz \ +&& ruby-install --latest \ +&& ruby-install -i /usr/local/ ruby 2.6.8 -- --disable-install-doc \ +&& gem update --system --no-document \ +&& gem install bundler:1.17.3 --force +#### diff --git a/33-jdk17-emulator/tools-emulator/android-start-emulator b/33-jdk17-emulator/tools-emulator/android-start-emulator new file mode 100755 index 0000000..998d92a --- /dev/null +++ b/33-jdk17-emulator/tools-emulator/android-start-emulator @@ -0,0 +1,9 @@ +#!/bin/bash +set -e + +# shellcheck disable=SC2086 +avdmanager create avd --package "$ANDROID_EMULATOR_PACKAGE" --name "${AVD_NAME:-test}" --abi "google_apis_playstore/x86_64" --device "${AVD_DEVICE:-pixel}" --force ${AVD_ARGS:-} +# shellcheck disable=SC2086 +emulator -avd "${AVD_NAME:-test}" -no-audio -no-boot-anim -no-window -accel on -gpu off ${EMULATOR_ARGS:-} & +android-wait-for-emulator +adb shell input keyevent 82 diff --git a/33-jdk17-emulator/tools-emulator/android-wait-for-emulator b/33-jdk17-emulator/tools-emulator/android-wait-for-emulator new file mode 100755 index 0000000..2bc2fb5 --- /dev/null +++ b/33-jdk17-emulator/tools-emulator/android-wait-for-emulator @@ -0,0 +1,30 @@ +#!/bin/bash +set -e +# Originally written by Ralf Kistner , but placed in the public domain + +sleep_time=5 +timeout_in_sec=60 + +fail_counter=0 +until [[ "$(adb -e shell getprop init.svc.bootanim)" =~ "stopped" ]]; do + ((fail_counter += sleep_time)) + echo "Waiting for emulator to start (bootanim)" + if [[ $fail_counter -gt timeout_in_sec ]]; then + echo "Timeout ($timeout_in_sec seconds) reached; failed to start emulator" + exit 1 + fi + sleep $sleep_time +done + +fail_counter=0 +until [[ "$(adb -e shell getprop sys.boot_completed)" == "1" ]]; do + ((fail_counter += sleep_time)) + echo "Waiting for emulator to start (boot_completed)" + if [[ $fail_counter -gt timeout_in_sec ]]; then + echo "Timeout ($timeout_in_sec seconds) reached; failed to start emulator" + exit 1 + fi + sleep $sleep_time +done + +echo "Emulator is ready" diff --git a/33-jdk17-emulator/tools/adb-all b/33-jdk17-emulator/tools/adb-all new file mode 100755 index 0000000..04992da --- /dev/null +++ b/33-jdk17-emulator/tools/adb-all @@ -0,0 +1,19 @@ +#!/bin/bash +# Script adb-all +# Taken from https://stackoverflow.com/a/8672540/859027 +# Usage +# You can run any command adb provide on all your current devices +# ./adb-all is the equivalent of ./adb -s +# +# Examples +# ./adb-all version +# ./adb-all install apidemo.apk +# ./adb-all uninstall com.example.android.apis + +adb devices | while read -r line; do + if [ ! "$line" = "" ] && [ "$(echo "$line" | awk '{print $2}')" = "device" ]; then + device=$(echo "$line" | awk '{print $1}') + echo "$device $* ..." + adb -s "$device" "$@" + fi +done diff --git a/33-jdk17-emulator/tools/license_accepter b/33-jdk17-emulator/tools/license_accepter new file mode 100755 index 0000000..388d973 --- /dev/null +++ b/33-jdk17-emulator/tools/license_accepter @@ -0,0 +1,47 @@ +#!/bin/bash + +check_android_sdk_root() { + if [ "$#" -lt 1 ]; then + if [ -z "${ANDROID_SDK_ROOT}" ]; then + echo "Please either set ANDROID_SDK_ROOT environment variable, or pass ANDROID_SDK_ROOT directory as a parameter" + exit 1 + fi + else + ANDROID_SDK_ROOT=$1 + fi + echo "ANDROID_SDK_ROOT is at $ANDROID_SDK_ROOT" +} + +accept_all_android_licenses() { + ANDROID_LICENSES="$ANDROID_SDK_ROOT/licenses" + if [ ! -d "$ANDROID_LICENSES" ]; then + echo "Android licenses directory doesn't exist, creating one..." + mkdir -p "$ANDROID_LICENSES" + fi + accept_license_of android-sdk-license 8933bad161af4178b1185d1a37fbf41ea5269c55 + accept_license_of android-sdk-license d56f5187479451eabf01fb78af6dfcb131a6481e + accept_license_of android-sdk-license 24333f8a63b6825ea9c5514f83c2829b004d1fee + accept_license_of android-sdk-preview-license 84831b9409646a918e30573bab4c9c91346d8abd + accept_license_of intel-android-extra-license d975f751698a77b662f1254ddbeed3901e976f5a + accept_license_of android-sdk-arm-dbt-license 859f317696f67ef3d7f30a50a5560e7834b43903 +} + +accept_license_of() { + local license=$1 + local content=$2 + local file=$ANDROID_LICENSES/$license + if [ -f "$file" ]; then + if grep -q "^$content$" "$file"; then + echo "$license: $content has been accepted already" + else + echo "Accepting $license: $content ..." + echo -e "$content" >>"$file" + fi + else + echo "Accepting $license: $content ..." + echo -e "$content" >"$file" + fi +} + +check_android_sdk_root "$@" +accept_all_android_licenses diff --git a/33-jdk17-ndk/Dockerfile b/33-jdk17-ndk/Dockerfile new file mode 100644 index 0000000..31ca75d --- /dev/null +++ b/33-jdk17-ndk/Dockerfile @@ -0,0 +1,104 @@ +FROM ubuntu:focal +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# hadolint ignore=DL3008 +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + expect \ + locales \ + nano \ + openjdk-17-jdk \ + unzip \ + curl \ + xz-utils \ + git \ + && rm -rf /var/lib/apt/lists/* + +# Seems somethings build better with utf8 locale specified +# http://jaredmarkell.com/docker-and-locales/ +# https://github.com/square/moshi/issues/804#issuecomment-466926878 +RUN locale-gen en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US:en +ENV LC_ALL=en_US.UTF-8 + +#### +# hadolint ignore=DL3008 +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + apt-transport-https \ + gnupg \ + lsb-release \ + # For nodejs we use nodesource, its nice and easy and gets us the correct version + # Find latest link https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions + && curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \ + && echo "deb https://deb.nodesource.com/node_18.x $(lsb_release -s -c) main" | tee /etc/apt/sources.list.d/nodesource.list \ + && echo "deb-src https://deb.nodesource.com/node_18.x $(lsb_release -s -c) main" | tee -a /etc/apt/sources.list.d/nodesource.list \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + nodejs \ + && rm -rf /var/lib/apt/lists/* + +# hadolint ignore=DL3016 +RUN npm -g install xcode-build-tools yarn +#### + +# Install the SDK +# https://developer.android.com/studio#downloads +ENV ANDROID_CMDLINE_TOOLS=https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip +# hadolint ignore=DL3003 +RUN ( \ + cd /opt \ + && mkdir android-sdk-linux \ + && curl -sSL -o cmdline-tools.zip "$ANDROID_CMDLINE_TOOLS" \ + && unzip cmdline-tools.zip -d android-sdk-linux/cmdline-tools \ + && rm -f cmdline-tools.zip \ + && chown -R root:root android-sdk-linux \ + ) + +ENV ANDROID_SDK_ROOT=/opt/android-sdk-linux +ENV ANDROID_HOME=$ANDROID_SDK_ROOT +ENV PATH=$ANDROID_HOME/cmdline-tools/cmdline-tools/bin:$ANDROID_HOME/cmdline-tools/tools/bin:$ANDROID_SDK_ROOT/tools/bin:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$PATH + +# Install custom tools +COPY tools/license_accepter /opt/tools/ +COPY tools/adb-all /opt/tools +ENV PATH=/opt/tools:$PATH +RUN license_accepter + +# Install Android platform and things +ENV ANDROID_PLATFORM_VERSION=33 +ENV ANDROID_BUILD_TOOLS_VERSION=33.0.0 +ENV PATH=$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION:$PATH +ENV ANDROID_EXTRA_PACKAGES="build-tools;33.0.0 build-tools;33.0.1 build-tools;33.0.2" +ENV ANDROID_REPOSITORIES="extras;android;m2repository extras;google;m2repository" +ENV ANDROID_CONSTRAINT_PACKAGES="extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2 extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1 extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0" +RUN sdkmanager --verbose "platform-tools" "platforms;android-$ANDROID_PLATFORM_VERSION" "build-tools;$ANDROID_BUILD_TOOLS_VERSION" $ANDROID_EXTRA_PACKAGES $ANDROID_REPOSITORIES $ANDROID_CONSTRAINT_PACKAGES + + + +#### +ENV ANDROID_NDK_PACKAGES="ndk-bundle cmake;3.10.2.4988404 cmake;3.6.4111459 cmake;3.18.1" +ENV ANDROID_NDK_ROOT=$ANDROID_HOME/ndk-bundle +ENV ANDROID_NDK_HOME=$ANDROID_NDK_ROOT +RUN sdkmanager --verbose $ANDROID_NDK_PACKAGES +#### + +#### +RUN apt-get update \ +&& apt-get -y --no-install-recommends install imagemagick=8:6.9.10.23+dfsg-2.1ubuntu11 \ +&& rm -rf /var/lib/apt/lists/* \ +&& curl -k -0L https://github.com/postmodern/ruby-install/archive/master.tar.gz -o ruby-install.tar.gz \ +&& tar -xzvf ruby-install.tar.gz +WORKDIR /ruby-install-master +RUN apt-get update && apt-get -y --no-install-recommends install make=4.2.1-1.2 \ +&& rm -rf /var/lib/apt/lists/* \ +&& make install +WORKDIR / +RUN apt-get update \ +&& rm -rf ruby-install-master && rm -rf ruby-install.tar.gz \ +&& ruby-install --latest \ +&& ruby-install -i /usr/local/ ruby 2.6.8 -- --disable-install-doc \ +&& gem update --system --no-document \ +&& gem install bundler:1.17.3 --force +#### diff --git a/33-jdk17-ndk/tools/adb-all b/33-jdk17-ndk/tools/adb-all new file mode 100755 index 0000000..04992da --- /dev/null +++ b/33-jdk17-ndk/tools/adb-all @@ -0,0 +1,19 @@ +#!/bin/bash +# Script adb-all +# Taken from https://stackoverflow.com/a/8672540/859027 +# Usage +# You can run any command adb provide on all your current devices +# ./adb-all is the equivalent of ./adb -s +# +# Examples +# ./adb-all version +# ./adb-all install apidemo.apk +# ./adb-all uninstall com.example.android.apis + +adb devices | while read -r line; do + if [ ! "$line" = "" ] && [ "$(echo "$line" | awk '{print $2}')" = "device" ]; then + device=$(echo "$line" | awk '{print $1}') + echo "$device $* ..." + adb -s "$device" "$@" + fi +done diff --git a/33-jdk17-ndk/tools/license_accepter b/33-jdk17-ndk/tools/license_accepter new file mode 100755 index 0000000..388d973 --- /dev/null +++ b/33-jdk17-ndk/tools/license_accepter @@ -0,0 +1,47 @@ +#!/bin/bash + +check_android_sdk_root() { + if [ "$#" -lt 1 ]; then + if [ -z "${ANDROID_SDK_ROOT}" ]; then + echo "Please either set ANDROID_SDK_ROOT environment variable, or pass ANDROID_SDK_ROOT directory as a parameter" + exit 1 + fi + else + ANDROID_SDK_ROOT=$1 + fi + echo "ANDROID_SDK_ROOT is at $ANDROID_SDK_ROOT" +} + +accept_all_android_licenses() { + ANDROID_LICENSES="$ANDROID_SDK_ROOT/licenses" + if [ ! -d "$ANDROID_LICENSES" ]; then + echo "Android licenses directory doesn't exist, creating one..." + mkdir -p "$ANDROID_LICENSES" + fi + accept_license_of android-sdk-license 8933bad161af4178b1185d1a37fbf41ea5269c55 + accept_license_of android-sdk-license d56f5187479451eabf01fb78af6dfcb131a6481e + accept_license_of android-sdk-license 24333f8a63b6825ea9c5514f83c2829b004d1fee + accept_license_of android-sdk-preview-license 84831b9409646a918e30573bab4c9c91346d8abd + accept_license_of intel-android-extra-license d975f751698a77b662f1254ddbeed3901e976f5a + accept_license_of android-sdk-arm-dbt-license 859f317696f67ef3d7f30a50a5560e7834b43903 +} + +accept_license_of() { + local license=$1 + local content=$2 + local file=$ANDROID_LICENSES/$license + if [ -f "$file" ]; then + if grep -q "^$content$" "$file"; then + echo "$license: $content has been accepted already" + else + echo "Accepting $license: $content ..." + echo -e "$content" >>"$file" + fi + else + echo "Accepting $license: $content ..." + echo -e "$content" >"$file" + fi +} + +check_android_sdk_root "$@" +accept_all_android_licenses diff --git a/33-jdk17-stf-client/Dockerfile b/33-jdk17-stf-client/Dockerfile new file mode 100644 index 0000000..8882e30 --- /dev/null +++ b/33-jdk17-stf-client/Dockerfile @@ -0,0 +1,117 @@ +FROM ubuntu:focal +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# hadolint ignore=DL3008 +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + expect \ + locales \ + nano \ + openjdk-17-jdk \ + unzip \ + curl \ + xz-utils \ + git \ + && rm -rf /var/lib/apt/lists/* + +# Seems somethings build better with utf8 locale specified +# http://jaredmarkell.com/docker-and-locales/ +# https://github.com/square/moshi/issues/804#issuecomment-466926878 +RUN locale-gen en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US:en +ENV LC_ALL=en_US.UTF-8 + +#### +# hadolint ignore=DL3008 +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + apt-transport-https \ + gnupg \ + lsb-release \ + # For nodejs we use nodesource, its nice and easy and gets us the correct version + # Find latest link https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions + && curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \ + && echo "deb https://deb.nodesource.com/node_18.x $(lsb_release -s -c) main" | tee /etc/apt/sources.list.d/nodesource.list \ + && echo "deb-src https://deb.nodesource.com/node_18.x $(lsb_release -s -c) main" | tee -a /etc/apt/sources.list.d/nodesource.list \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + nodejs \ + && rm -rf /var/lib/apt/lists/* + +# hadolint ignore=DL3016 +RUN npm -g install xcode-build-tools yarn +#### + +# Install the SDK +# https://developer.android.com/studio#downloads +ENV ANDROID_CMDLINE_TOOLS=https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip +# hadolint ignore=DL3003 +RUN ( \ + cd /opt \ + && mkdir android-sdk-linux \ + && curl -sSL -o cmdline-tools.zip "$ANDROID_CMDLINE_TOOLS" \ + && unzip cmdline-tools.zip -d android-sdk-linux/cmdline-tools \ + && rm -f cmdline-tools.zip \ + && chown -R root:root android-sdk-linux \ + ) + +ENV ANDROID_SDK_ROOT=/opt/android-sdk-linux +ENV ANDROID_HOME=$ANDROID_SDK_ROOT +ENV PATH=$ANDROID_HOME/cmdline-tools/cmdline-tools/bin:$ANDROID_HOME/cmdline-tools/tools/bin:$ANDROID_SDK_ROOT/tools/bin:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$PATH + +# Install custom tools +COPY tools/license_accepter /opt/tools/ +COPY tools/adb-all /opt/tools +ENV PATH=/opt/tools:$PATH +RUN license_accepter + +# Install Android platform and things +ENV ANDROID_PLATFORM_VERSION=33 +ENV ANDROID_BUILD_TOOLS_VERSION=33.0.0 +ENV PATH=$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION:$PATH +ENV ANDROID_EXTRA_PACKAGES="build-tools;33.0.0 build-tools;33.0.1 build-tools;33.0.2" +ENV ANDROID_REPOSITORIES="extras;android;m2repository extras;google;m2repository" +ENV ANDROID_CONSTRAINT_PACKAGES="extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2 extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1 extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0" +RUN sdkmanager --verbose "platform-tools" "platforms;android-$ANDROID_PLATFORM_VERSION" "build-tools;$ANDROID_BUILD_TOOLS_VERSION" $ANDROID_EXTRA_PACKAGES $ANDROID_REPOSITORIES $ANDROID_CONSTRAINT_PACKAGES + +#### +# hadolint ignore=DL3008,DL3028,SC2086 +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + ruby \ + && savedAptMark="$(apt-mark showmanual)" \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + # stf-client + build-essential \ + gem \ + # Without rake fails to install stf-client + && gem install rake stf-client --no-doc \ + && apt-mark auto '.*' > /dev/null \ + && apt-mark manual $savedAptMark > /dev/null \ + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ + && rm -rf /var/lib/apt/lists/* \ + +RUN adb keygen ~/.android/adbkey +#### + + + +#### +RUN apt-get update \ +&& apt-get -y --no-install-recommends install imagemagick=8:6.9.10.23+dfsg-2.1ubuntu11 \ +&& rm -rf /var/lib/apt/lists/* \ +&& curl -k -0L https://github.com/postmodern/ruby-install/archive/master.tar.gz -o ruby-install.tar.gz \ +&& tar -xzvf ruby-install.tar.gz +WORKDIR /ruby-install-master +RUN apt-get update && apt-get -y --no-install-recommends install make=4.2.1-1.2 \ +&& rm -rf /var/lib/apt/lists/* \ +&& make install +WORKDIR / +RUN apt-get update \ +&& rm -rf ruby-install-master && rm -rf ruby-install.tar.gz \ +&& ruby-install --latest \ +&& ruby-install -i /usr/local/ ruby 2.6.8 -- --disable-install-doc \ +&& gem update --system --no-document \ +&& gem install bundler:1.17.3 --force +#### diff --git a/33-jdk17-stf-client/tools/adb-all b/33-jdk17-stf-client/tools/adb-all new file mode 100755 index 0000000..04992da --- /dev/null +++ b/33-jdk17-stf-client/tools/adb-all @@ -0,0 +1,19 @@ +#!/bin/bash +# Script adb-all +# Taken from https://stackoverflow.com/a/8672540/859027 +# Usage +# You can run any command adb provide on all your current devices +# ./adb-all is the equivalent of ./adb -s +# +# Examples +# ./adb-all version +# ./adb-all install apidemo.apk +# ./adb-all uninstall com.example.android.apis + +adb devices | while read -r line; do + if [ ! "$line" = "" ] && [ "$(echo "$line" | awk '{print $2}')" = "device" ]; then + device=$(echo "$line" | awk '{print $1}') + echo "$device $* ..." + adb -s "$device" "$@" + fi +done diff --git a/33-jdk17-stf-client/tools/license_accepter b/33-jdk17-stf-client/tools/license_accepter new file mode 100755 index 0000000..388d973 --- /dev/null +++ b/33-jdk17-stf-client/tools/license_accepter @@ -0,0 +1,47 @@ +#!/bin/bash + +check_android_sdk_root() { + if [ "$#" -lt 1 ]; then + if [ -z "${ANDROID_SDK_ROOT}" ]; then + echo "Please either set ANDROID_SDK_ROOT environment variable, or pass ANDROID_SDK_ROOT directory as a parameter" + exit 1 + fi + else + ANDROID_SDK_ROOT=$1 + fi + echo "ANDROID_SDK_ROOT is at $ANDROID_SDK_ROOT" +} + +accept_all_android_licenses() { + ANDROID_LICENSES="$ANDROID_SDK_ROOT/licenses" + if [ ! -d "$ANDROID_LICENSES" ]; then + echo "Android licenses directory doesn't exist, creating one..." + mkdir -p "$ANDROID_LICENSES" + fi + accept_license_of android-sdk-license 8933bad161af4178b1185d1a37fbf41ea5269c55 + accept_license_of android-sdk-license d56f5187479451eabf01fb78af6dfcb131a6481e + accept_license_of android-sdk-license 24333f8a63b6825ea9c5514f83c2829b004d1fee + accept_license_of android-sdk-preview-license 84831b9409646a918e30573bab4c9c91346d8abd + accept_license_of intel-android-extra-license d975f751698a77b662f1254ddbeed3901e976f5a + accept_license_of android-sdk-arm-dbt-license 859f317696f67ef3d7f30a50a5560e7834b43903 +} + +accept_license_of() { + local license=$1 + local content=$2 + local file=$ANDROID_LICENSES/$license + if [ -f "$file" ]; then + if grep -q "^$content$" "$file"; then + echo "$license: $content has been accepted already" + else + echo "Accepting $license: $content ..." + echo -e "$content" >>"$file" + fi + else + echo "Accepting $license: $content ..." + echo -e "$content" >"$file" + fi +} + +check_android_sdk_root "$@" +accept_all_android_licenses diff --git a/33-jdk17/Dockerfile b/33-jdk17/Dockerfile new file mode 100644 index 0000000..ad23613 --- /dev/null +++ b/33-jdk17/Dockerfile @@ -0,0 +1,98 @@ +FROM ubuntu:focal +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# hadolint ignore=DL3008 +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + expect \ + locales \ + nano \ + openjdk-17-jdk \ + unzip \ + curl \ + xz-utils \ + git \ + && rm -rf /var/lib/apt/lists/* + +# Seems somethings build better with utf8 locale specified +# http://jaredmarkell.com/docker-and-locales/ +# https://github.com/square/moshi/issues/804#issuecomment-466926878 +RUN locale-gen en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US:en +ENV LC_ALL=en_US.UTF-8 + +#### +# hadolint ignore=DL3008 +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + apt-transport-https \ + gnupg \ + lsb-release \ + # For nodejs we use nodesource, its nice and easy and gets us the correct version + # Find latest link https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions + && curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \ + && echo "deb https://deb.nodesource.com/node_18.x $(lsb_release -s -c) main" | tee /etc/apt/sources.list.d/nodesource.list \ + && echo "deb-src https://deb.nodesource.com/node_18.x $(lsb_release -s -c) main" | tee -a /etc/apt/sources.list.d/nodesource.list \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + nodejs \ + && rm -rf /var/lib/apt/lists/* + +# hadolint ignore=DL3016 +RUN npm -g install xcode-build-tools yarn +#### + +# Install the SDK +# https://developer.android.com/studio#downloads +ENV ANDROID_CMDLINE_TOOLS=https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip +# hadolint ignore=DL3003 +RUN ( \ + cd /opt \ + && mkdir android-sdk-linux \ + && curl -sSL -o cmdline-tools.zip "$ANDROID_CMDLINE_TOOLS" \ + && unzip cmdline-tools.zip -d android-sdk-linux/cmdline-tools \ + && rm -f cmdline-tools.zip \ + && chown -R root:root android-sdk-linux \ + ) + +ENV ANDROID_SDK_ROOT=/opt/android-sdk-linux +ENV ANDROID_HOME=$ANDROID_SDK_ROOT +ENV PATH=$ANDROID_HOME/cmdline-tools/cmdline-tools/bin:$ANDROID_HOME/cmdline-tools/tools/bin:$ANDROID_SDK_ROOT/tools/bin:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$PATH + +# Install custom tools +COPY tools/license_accepter /opt/tools/ +COPY tools/adb-all /opt/tools +ENV PATH=/opt/tools:$PATH +RUN license_accepter + +# Install Android platform and things +ENV ANDROID_PLATFORM_VERSION=33 +ENV ANDROID_BUILD_TOOLS_VERSION=33.0.0 +ENV PATH=$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION:$PATH +ENV ANDROID_EXTRA_PACKAGES="build-tools;33.0.0 build-tools;33.0.1 build-tools;33.0.2" +ENV ANDROID_REPOSITORIES="extras;android;m2repository extras;google;m2repository" +ENV ANDROID_CONSTRAINT_PACKAGES="extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2 extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1 extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0" +RUN sdkmanager --verbose "platform-tools" "platforms;android-$ANDROID_PLATFORM_VERSION" "build-tools;$ANDROID_BUILD_TOOLS_VERSION" $ANDROID_EXTRA_PACKAGES $ANDROID_REPOSITORIES $ANDROID_CONSTRAINT_PACKAGES + + + + +#### +RUN apt-get update \ +&& apt-get -y --no-install-recommends install imagemagick=8:6.9.10.23+dfsg-2.1ubuntu11 \ +&& rm -rf /var/lib/apt/lists/* \ +&& curl -k -0L https://github.com/postmodern/ruby-install/archive/master.tar.gz -o ruby-install.tar.gz \ +&& tar -xzvf ruby-install.tar.gz +WORKDIR /ruby-install-master +RUN apt-get update && apt-get -y --no-install-recommends install make=4.2.1-1.2 \ +&& rm -rf /var/lib/apt/lists/* \ +&& make install +WORKDIR / +RUN apt-get update \ +&& rm -rf ruby-install-master && rm -rf ruby-install.tar.gz \ +&& ruby-install --latest \ +&& ruby-install -i /usr/local/ ruby 2.6.8 -- --disable-install-doc \ +&& gem update --system --no-document \ +&& gem install bundler:1.17.3 --force +#### diff --git a/33-jdk17/tools/adb-all b/33-jdk17/tools/adb-all new file mode 100755 index 0000000..04992da --- /dev/null +++ b/33-jdk17/tools/adb-all @@ -0,0 +1,19 @@ +#!/bin/bash +# Script adb-all +# Taken from https://stackoverflow.com/a/8672540/859027 +# Usage +# You can run any command adb provide on all your current devices +# ./adb-all is the equivalent of ./adb -s +# +# Examples +# ./adb-all version +# ./adb-all install apidemo.apk +# ./adb-all uninstall com.example.android.apis + +adb devices | while read -r line; do + if [ ! "$line" = "" ] && [ "$(echo "$line" | awk '{print $2}')" = "device" ]; then + device=$(echo "$line" | awk '{print $1}') + echo "$device $* ..." + adb -s "$device" "$@" + fi +done diff --git a/33-jdk17/tools/license_accepter b/33-jdk17/tools/license_accepter new file mode 100755 index 0000000..388d973 --- /dev/null +++ b/33-jdk17/tools/license_accepter @@ -0,0 +1,47 @@ +#!/bin/bash + +check_android_sdk_root() { + if [ "$#" -lt 1 ]; then + if [ -z "${ANDROID_SDK_ROOT}" ]; then + echo "Please either set ANDROID_SDK_ROOT environment variable, or pass ANDROID_SDK_ROOT directory as a parameter" + exit 1 + fi + else + ANDROID_SDK_ROOT=$1 + fi + echo "ANDROID_SDK_ROOT is at $ANDROID_SDK_ROOT" +} + +accept_all_android_licenses() { + ANDROID_LICENSES="$ANDROID_SDK_ROOT/licenses" + if [ ! -d "$ANDROID_LICENSES" ]; then + echo "Android licenses directory doesn't exist, creating one..." + mkdir -p "$ANDROID_LICENSES" + fi + accept_license_of android-sdk-license 8933bad161af4178b1185d1a37fbf41ea5269c55 + accept_license_of android-sdk-license d56f5187479451eabf01fb78af6dfcb131a6481e + accept_license_of android-sdk-license 24333f8a63b6825ea9c5514f83c2829b004d1fee + accept_license_of android-sdk-preview-license 84831b9409646a918e30573bab4c9c91346d8abd + accept_license_of intel-android-extra-license d975f751698a77b662f1254ddbeed3901e976f5a + accept_license_of android-sdk-arm-dbt-license 859f317696f67ef3d7f30a50a5560e7834b43903 +} + +accept_license_of() { + local license=$1 + local content=$2 + local file=$ANDROID_LICENSES/$license + if [ -f "$file" ]; then + if grep -q "^$content$" "$file"; then + echo "$license: $content has been accepted already" + else + echo "Accepting $license: $content ..." + echo -e "$content" >>"$file" + fi + else + echo "Accepting $license: $content ..." + echo -e "$content" >"$file" + fi +} + +check_android_sdk_root "$@" +accept_all_android_licenses diff --git a/README.md b/README.md index da60844..f22eced 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,18 @@ An image that lets us build android apps with docker using gitlab-ci ## Tags available +* `33-jdk17` +* `33-jdk17-emulator` +* `33-jdk17-ndk` +* `33-jdk17-stf-client` +* `33` +* `33-emulator` +* `33-ndk` +* `33-stf-client` +* `32` +* `32-emulator` +* `32-ndk` +* `32-stf-client` * `31` * `31-emulator` * `31-ndk` diff --git a/update.sh b/update.sh index 5d86068..622bc27 100755 --- a/update.sh +++ b/update.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e -variants=('30' '31' '32' '33') +variants=('30' '31' '32' '33' '33-jdk17') ## Disabled creating extra node variants, rather just having a default for each SDK #node_variants=('14' '18') @@ -10,6 +10,7 @@ declare -A default_node_variants=( ['31']='14' ['32']='18' ['33']='18' + ['33-jdk17']='18' ) jdk_variants=('11') @@ -20,6 +21,7 @@ declare -A build_tools=( ['31']='31.0.0' ['32']='32.0.0' ['33']='33.0.0' + ['33-jdk17']='33.0.0' ) declare -A extra_packages=( @@ -27,6 +29,7 @@ declare -A extra_packages=( ['31']='"build-tools;31.0.0"' ['32']='"build-tools;32.0.0"' ['33']='"build-tools;33.0.0 build-tools;33.0.1 build-tools;33.0.2"' + ['33-jdk17']='"build-tools;33.0.0 build-tools;33.0.1 build-tools;33.0.2"' ) for variant in "${variants[@]}"; do