mirror of
https://onedev.site.tesses.net/Dependencies/AndroidDotnetDocker
synced 2026-02-08 10:05:46 +00:00
Build android dotnet
This commit is contained in:
50
Dockerfile
Normal file
50
Dockerfile
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
FROM debian:bookworm
|
||||||
|
|
||||||
|
LABEL de.mindrunner.android-docker.flavour="ubuntu-standalone"
|
||||||
|
|
||||||
|
ENV ANDROID_SDK_HOME /opt/android-sdk-linux
|
||||||
|
ENV ANDROID_SDK_ROOT /opt/android-sdk-linux
|
||||||
|
ENV ANDROID_HOME /opt/android-sdk-linux
|
||||||
|
ENV ANDROID_SDK /opt/android-sdk-linux
|
||||||
|
|
||||||
|
ENV PATH $PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/cmdline-tools/latest/bin/:$ANDROID_HOME/build-tools/34.0.0/:$ANDROID_HOME/emulator/:$ANDROID_HOME/bin:/opt/tools
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
|
||||||
|
RUN dpkg --add-architecture i386 && apt-get update -yqq && apt-get install -y \
|
||||||
|
curl \
|
||||||
|
expect \
|
||||||
|
git \
|
||||||
|
libarchive-tools \
|
||||||
|
locales \
|
||||||
|
make \
|
||||||
|
openjdk-17-jdk \
|
||||||
|
openssh-client \
|
||||||
|
unzip \
|
||||||
|
vim \
|
||||||
|
wget \
|
||||||
|
zip \
|
||||||
|
&& wget -q https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
|
||||||
|
&& dpkg -i packages-microsoft-prod.deb \
|
||||||
|
&& rm packages-microsoft-prod.deb \
|
||||||
|
&& apt-get update && apt-get install -y dotnet-sdk-7.0 dotnet-sdk-8.0 dotnet-sdk-9.0 \
|
||||||
|
&& dotnet workload install android \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
|
||||||
|
|
||||||
|
|
||||||
|
ENV LANG en_US.UTF-8
|
||||||
|
|
||||||
|
RUN groupadd android && useradd -d /opt/android-sdk-linux -g android -u 1000 android
|
||||||
|
|
||||||
|
COPY tools /opt/tools
|
||||||
|
|
||||||
|
COPY licenses /opt/licenses
|
||||||
|
|
||||||
|
WORKDIR /opt/android-sdk-linux
|
||||||
|
|
||||||
|
RUN entrypoint.sh built-in
|
||||||
|
|
||||||
|
CMD entrypoint.sh built-in
|
||||||
|
|
||||||
2
licenses/android-googletv-license
Normal file
2
licenses/android-googletv-license
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
601085b94cd77f0b54ff86406957099ebe79c4d6
|
||||||
3
licenses/android-sdk-license
Normal file
3
licenses/android-sdk-license
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
d56f5187479451eabf01fb78af6dfcb131a6481e
|
||||||
|
24333f8a63b6825ea9c5514f83c2829b004d1fee
|
||||||
2
licenses/android-sdk-preview-license
Normal file
2
licenses/android-sdk-preview-license
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
84831b9409646a918e30573bab4c9c91346d8abd
|
||||||
2
licenses/google-gdk-license
Normal file
2
licenses/google-gdk-license
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
33b6a2b64607f11b759f320ef9dff4ae5c47d97a
|
||||||
2
licenses/mips-android-sysimage-license
Normal file
2
licenses/mips-android-sysimage-license
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
e9acab5b5fbb560a72cfaecce8946896ff6aab9d
|
||||||
14
tools/android-accept-licenses.sh
Executable file
14
tools/android-accept-licenses.sh
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/expect -f
|
||||||
|
|
||||||
|
set timeout 1800
|
||||||
|
set cmd [lindex $argv 0]
|
||||||
|
set licenses [lindex $argv 1]
|
||||||
|
|
||||||
|
spawn {*}$cmd
|
||||||
|
expect {
|
||||||
|
"(y/N)" {
|
||||||
|
exp_send "y\r"
|
||||||
|
exp_continue
|
||||||
|
}
|
||||||
|
eof
|
||||||
|
}
|
||||||
52
tools/android-env.sh
Normal file
52
tools/android-env.sh
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
export ANDROID_HOME=/opt/android-sdk-linux
|
||||||
|
export ANDROID_SDK_ROOT=${ANDROID_HOME}
|
||||||
|
export ANDROID_SDK_HOME=${ANDROID_HOME}
|
||||||
|
export ANDROID_SDK=${ANDROID_HOME}
|
||||||
|
|
||||||
|
export PATH=${PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/emulator:${ANDROID_HOME}/bin:
|
||||||
|
|
||||||
|
if [[ ! -z "$http_proxy" ]] || [[ ! -z "$https_proxy" ]]; then
|
||||||
|
export JAVA_OPTS="-Djava.net.useSystemProxies=true $JAVA_OPTS -Dhttp.noProxyHosts=${no_proxy}"
|
||||||
|
# This only works if there is a proxy listening on docker host machine and
|
||||||
|
# container is started with --net=host. No other options for now. Thanks
|
||||||
|
# google....
|
||||||
|
export SDKMNGR_OPTS=" --proxy=http --proxy_host=127.0.0.1 --proxy_port=3128 --no_https "
|
||||||
|
fi
|
||||||
|
|
||||||
|
function print_header() {
|
||||||
|
figlet SBB CFF FFS
|
||||||
|
figlet welcome to
|
||||||
|
figlet andep
|
||||||
|
echo ''
|
||||||
|
echo ''
|
||||||
|
echo ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function help() {
|
||||||
|
figlet "usage:"
|
||||||
|
echo "update_sdk: Updates the SDK"
|
||||||
|
echo "andep: Installs one or more android Packets."
|
||||||
|
echo " -Example: anddep \"platforms;android-26\""
|
||||||
|
echo "help: Shows this help"
|
||||||
|
echo ''
|
||||||
|
echo ''
|
||||||
|
echo ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_sdk() {
|
||||||
|
android-accept-licenses.sh "sdkmanager ${SDKMNGR_OPTS} --update"
|
||||||
|
}
|
||||||
|
|
||||||
|
function andep() {
|
||||||
|
if [ -z ${1} ]; then
|
||||||
|
help
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
android-accept-licenses.sh "sdkmanager ${SDKMNGR_OPTS} ${1}"
|
||||||
|
}
|
||||||
|
|
||||||
|
export -f help
|
||||||
|
export -f update_sdk
|
||||||
|
export -f andep
|
||||||
76
tools/android-sdk-update.sh
Executable file
76
tools/android-sdk-update.sh
Executable file
@@ -0,0 +1,76 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
mkdir -p /opt/android-sdk-linux/bin/
|
||||||
|
cp /opt/tools/android-env.sh /opt/android-sdk-linux/bin/
|
||||||
|
source /opt/android-sdk-linux/bin/android-env.sh
|
||||||
|
|
||||||
|
built_in_sdk=1
|
||||||
|
|
||||||
|
if [ $# -ge 0 ] && [ "$1" == "lazy-dl" ]
|
||||||
|
then
|
||||||
|
echo "Using Lazy Download Flavour"
|
||||||
|
built_in_sdk=0
|
||||||
|
elif [ $# -ge 0 ] && [ "$1" == "built-in" ]
|
||||||
|
then
|
||||||
|
echo "Using Built-In SDK Flavour"
|
||||||
|
built_in_sdk=1
|
||||||
|
else
|
||||||
|
echo "Please use either built-in or lazy-dl as parameter"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd ${ANDROID_HOME}
|
||||||
|
echo "Set ANDROID_HOME to ${ANDROID_HOME}"
|
||||||
|
|
||||||
|
if [ -f .bootstrapped ]
|
||||||
|
then
|
||||||
|
echo "SDK Tools already bootstrapped. Skipping initial setup"
|
||||||
|
else
|
||||||
|
echo "Bootstrapping SDK-Tools"
|
||||||
|
mkdir -p cmdline-tools/latest/ \
|
||||||
|
&& curl -sSL https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -o sdk-tools-linux.zip \
|
||||||
|
&& bsdtar xvf sdk-tools-linux.zip --strip-components=1 -C cmdline-tools/latest \
|
||||||
|
&& rm sdk-tools-linux.zip \
|
||||||
|
&& touch .bootstrapped
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Make sure repositories.cfg exists"
|
||||||
|
mkdir -p ~/.android/
|
||||||
|
touch ~/.android/repositories.cfg
|
||||||
|
|
||||||
|
echo "Copying Licences"
|
||||||
|
cp -rv /opt/licenses ${ANDROID_HOME}/licenses
|
||||||
|
|
||||||
|
echo "Copying Tools"
|
||||||
|
mkdir -p ${ANDROID_HOME}/bin
|
||||||
|
cp -v /opt/tools/*.sh ${ANDROID_HOME}/bin
|
||||||
|
|
||||||
|
echo "Print sdkmanager version"
|
||||||
|
sdkmanager --version
|
||||||
|
|
||||||
|
|
||||||
|
echo "Installing packages"
|
||||||
|
if [ $built_in_sdk -eq 1 ]
|
||||||
|
then
|
||||||
|
while read p; do
|
||||||
|
android-accept-licenses.sh "sdkmanager ${SDKMNGR_OPTS} ${p}"
|
||||||
|
done < /opt/tools/package-list-minimal.txt
|
||||||
|
else
|
||||||
|
while read p; do
|
||||||
|
android-accept-licenses.sh "sdkmanager ${SDKMNGR_OPTS} ${p}"
|
||||||
|
done < /opt/tools/package-list.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Updating SDK"
|
||||||
|
update_sdk
|
||||||
|
|
||||||
|
echo "Accepting Licenses"
|
||||||
|
android-accept-licenses.sh "sdkmanager ${SDKMNGR_OPTS} --licenses"
|
||||||
|
|
||||||
|
# https://stackoverflow.com/questions/35128229/error-no-toolchains-found-in-the-ndk-toolchains-folder-for-abi-with-prefix-llv
|
||||||
|
if [ -d /opt/android-sdk-linux/ndk-bundle/toolchains ]
|
||||||
|
then
|
||||||
|
( cd /opt/android-sdk-linux/ndk-bundle/toolchains \
|
||||||
|
&& ln -sf aarch64-linux-android-4.9 mips64el-linux-android \
|
||||||
|
&& ln -sf arm-linux-androideabi-4.9 mipsel-linux-android )
|
||||||
|
fi
|
||||||
30
tools/android-wait-for-emulator.sh
Executable file
30
tools/android-wait-for-emulator.sh
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set +e
|
||||||
|
|
||||||
|
bootcomplete=""
|
||||||
|
failcounter=0
|
||||||
|
timeout=600
|
||||||
|
sleeptime=10
|
||||||
|
maxfail=$((timeout / sleeptime))
|
||||||
|
|
||||||
|
until [[ "${bootcomplete}" =~ "1" ]]; do
|
||||||
|
bootcomplete=`adb -e shell getprop dev.bootcomplete 2>&1 &`
|
||||||
|
if [[ "${bootcomplete}" =~ "" ]]; then
|
||||||
|
((failcounter += 1))
|
||||||
|
echo "Waiting for emulator to start"
|
||||||
|
if [[ ${failcounter} -gt ${maxfail} ]]; then
|
||||||
|
echo "Timeout ($timeout seconds) reached; failed to start emulator"
|
||||||
|
while pkill -9 "emulator" >/dev/null 2>&1; do
|
||||||
|
echo "Killing emulator process...."
|
||||||
|
pgrep "emulator"
|
||||||
|
done
|
||||||
|
echo "Process terminated"
|
||||||
|
pgrep "emulator"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
sleep ${sleeptime}
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Emulator is ready"
|
||||||
26
tools/entrypoint.sh
Executable file
26
tools/entrypoint.sh
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function checkbin() {
|
||||||
|
type -P su-exec
|
||||||
|
}
|
||||||
|
|
||||||
|
function su_mt_user() {
|
||||||
|
su android -c '"$0" "$@"' -- "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
chown android:android /opt/android-sdk-linux
|
||||||
|
|
||||||
|
printenv
|
||||||
|
|
||||||
|
if checkbin; then
|
||||||
|
exec su-exec android:android /opt/tools/android-sdk-update.sh "$@"
|
||||||
|
else
|
||||||
|
su_mt_user /opt/tools/android-sdk-update.sh ${1}
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
26
tools/package-list-minimal.txt
Normal file
26
tools/package-list-minimal.txt
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
build-tools;32.0.0
|
||||||
|
build-tools;33.0.2
|
||||||
|
build-tools;34.0.0
|
||||||
|
build-tools;35.0.0
|
||||||
|
cmake
|
||||||
|
emulator
|
||||||
|
extras;android;gapid;3
|
||||||
|
extras;android;m2repository
|
||||||
|
extras;google;auto
|
||||||
|
extras;google;google_play_services
|
||||||
|
extras;google;instantapps
|
||||||
|
extras;google;m2repository
|
||||||
|
extras;google;market_apk_expansion
|
||||||
|
extras;google;market_licensing
|
||||||
|
extras;google;simulators
|
||||||
|
extras;google;webdriver
|
||||||
|
extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2
|
||||||
|
extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2
|
||||||
|
lldb
|
||||||
|
ndk-bundle
|
||||||
|
platform-tools
|
||||||
|
platforms;android-32
|
||||||
|
platforms;android-33
|
||||||
|
platforms;android-34
|
||||||
|
platforms;android-35
|
||||||
|
tools
|
||||||
45
tools/package-list.txt
Normal file
45
tools/package-list.txt
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
add-ons;addon-google_apis-google-22
|
||||||
|
add-ons;addon-google_apis-google-23
|
||||||
|
add-ons;addon-google_apis-google-24
|
||||||
|
build-tools;32.0.0
|
||||||
|
build-tools;33.0.2
|
||||||
|
build-tools;34.0.0
|
||||||
|
build-tools;35.0.0
|
||||||
|
cmake;3.10.2.4988404
|
||||||
|
cmake;3.6.4111459
|
||||||
|
docs
|
||||||
|
emulator
|
||||||
|
extras;android;gapid;1
|
||||||
|
extras;android;gapid;3
|
||||||
|
extras;android;m2repository
|
||||||
|
extras;google;auto
|
||||||
|
extras;google;google_play_services
|
||||||
|
extras;google;instantapps
|
||||||
|
extras;google;m2repository
|
||||||
|
extras;google;market_apk_expansion
|
||||||
|
extras;google;market_licensing
|
||||||
|
extras;google;simulators
|
||||||
|
extras;google;webdriver
|
||||||
|
extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2
|
||||||
|
extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2
|
||||||
|
lldb;3.1
|
||||||
|
ndk-bundle
|
||||||
|
patcher;v4
|
||||||
|
platform-tools
|
||||||
|
platforms;android-32
|
||||||
|
platforms;android-33
|
||||||
|
platforms;android-34
|
||||||
|
platforms;android-35
|
||||||
|
system-images;android-32;google_apis;x86
|
||||||
|
system-images;android-32;google_apis;x86_64
|
||||||
|
system-images;android-32;google_apis_playstore;x86
|
||||||
|
system-images;android-32;google_apis_playstore;x86_64
|
||||||
|
system-images;android-33;google_apis;x86
|
||||||
|
system-images;android-33;google_apis;x86_64
|
||||||
|
system-images;android-33;google_apis_playstore;x86
|
||||||
|
system-images;android-33;google_apis_playstore;x86_64
|
||||||
|
system-images;android-34;google_apis;x86
|
||||||
|
system-images;android-34;google_apis;x86_64
|
||||||
|
system-images;android-34;google_apis_playstore;x86
|
||||||
|
system-images;android-34;google_apis_playstore;x86_64
|
||||||
|
tools
|
||||||
Reference in New Issue
Block a user