Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update default jdkVersion to 17 #15

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
119 changes: 119 additions & 0 deletions 33-jdk17-emulator/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

##<node>##
# 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
##</node>##

# 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


##<emulator>##
# 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
##</emulator>##


##<ruby-bundler>##
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
##</ruby-bundler>##
9 changes: 9 additions & 0 deletions 33-jdk17-emulator/tools-emulator/android-start-emulator
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions 33-jdk17-emulator/tools-emulator/android-wait-for-emulator
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -e
# Originally written by Ralf Kistner <ralf@embarkmobile.com>, 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"
19 changes: 19 additions & 0 deletions 33-jdk17-emulator/tools/adb-all
Original file line number Diff line number Diff line change
@@ -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 <command> is the equivalent of ./adb -s <serial number> <command>
#
# 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
47 changes: 47 additions & 0 deletions 33-jdk17-emulator/tools/license_accepter
Original file line number Diff line number Diff line change
@@ -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
104 changes: 104 additions & 0 deletions 33-jdk17-ndk/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

##<node>##
# 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
##</node>##

# 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



##<ndk>##
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
##</ndk>##

##<ruby-bundler>##
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
##</ruby-bundler>##
19 changes: 19 additions & 0 deletions 33-jdk17-ndk/tools/adb-all
Original file line number Diff line number Diff line change
@@ -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 <command> is the equivalent of ./adb -s <serial number> <command>
#
# 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
Loading