forked from rabits/dockerfiles
-
Notifications
You must be signed in to change notification settings - Fork 13
/
6.5-android.Dockerfile
80 lines (75 loc) · 3.37 KB
/
6.5-android.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Docker container to build Qt 6.5 for Android projects with latest cmake
# Image: a12e/docker-qt:6.5-android
FROM ubuntu:22.04
MAINTAINER Aurélien Brooke <[email protected]>
ARG ANDROID_NDK_VERSION=25.1.8937393
ARG AQT_EXTRA_ARGS="--module qt3d qtshadertools qtmultimedia"
ARG CMAKE_VERSION=3.27.7
ARG EXTRA_PACKAGES="git openssh-client"
ARG OPENSSL_VERSION=3.0.11
ARG QT_VERSION=6.5.3
ARG SDKMANAGER_EXTRA_ARGS=""
ENV ANDROID_SDK_ROOT=/opt/android-sdk \
ANDROID_NDK_ROOT=/opt/android-sdk/ndk/${ANDROID_NDK_VERSION} \
QT_ANDROID_PATH=/opt/qt/${QT_VERSION}/android_arm64_v8a \
QT_HOST_PATH=/opt/qt/${QT_VERSION}/gcc_64 \
QT_VERSION=${QT_VERSION}
ENV ANDROID_NDK_HOME=${ANDROID_NDK_ROOT} \
PATH=/opt/android-sdk/cmdline-tools/latest/bin:${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin:${QT_ANDROID_PATH}/bin:${PATH}
RUN set -xe \
&& export DEBIAN_FRONTEND=noninteractive \
&& BUILD_PACKAGES="python3-pip" \
&& apt update \
&& apt full-upgrade -y \
&& apt install -y --no-install-recommends \
${BUILD_PACKAGES} \
${EXTRA_PACKAGES} \
curl \
ca-certificates \
default-jdk-headless \
make \
perl \
software-properties-common \
sudo \
unzip \
xz-utils \
&& curl -Lo install-cmake.sh https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh \
&& chmod +x install-cmake.sh \
&& ./install-cmake.sh --skip-license --prefix=/usr/local \
&& rm -fv install-cmake.sh \
&& curl -Lo tools.zip https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip \
&& unzip tools.zip && rm tools.zip \
&& mkdir -p /opt/android-sdk/cmdline-tools/ \
&& mv -v cmdline-tools /opt/android-sdk/cmdline-tools/latest \
&& yes | sdkmanager --licenses \
&& sdkmanager --update \
&& sdkmanager "platforms;android-33" "platform-tools" "build-tools;33.0.2" "ndk;${ANDROID_NDK_VERSION}" ${SDKMANAGER_EXTRA_ARGS} \
&& pip install aqtinstall \
&& aqt install-qt linux desktop ${QT_VERSION} gcc_64 --outputdir /opt/qt \
&& curl -Lo openssl.tar.gz https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \
&& for QT_ARCH in arm64_v8a armv7 x86 x86_64 ; do \
aqt install-qt linux android ${QT_VERSION} android_${QT_ARCH} --outputdir /opt/qt ${AQT_EXTRA_ARGS} ; \
case $QT_ARCH in \
"arm64_v8a" ) OPENSSL_ARCH=arm64 ;; \
"armv7" ) OPENSSL_ARCH=arm ;; \
"x86" ) OPENSSL_ARCH=x86 ;; \
"x86_64" ) OPENSSL_ARCH=x86_64 ;; \
esac ; \
tar xzf openssl.tar.gz ; \
cd openssl-${OPENSSL_VERSION}/ ; \
sed -i 's/sub shlibvariant { $target{shlib_variant} || "" }/sub shlibvariant { "_3" }/g' ./Configurations/platform/Unix.pm ; \
./Configure android-${OPENSSL_ARCH} shared zlib-dynamic -no-engine no-tests --prefix=/opt/qt/${QT_VERSION}/android_${QT_ARCH} -D__ANDROID_API__=23 ; \
make build_libs ; \
make install_sw ; \
cd ../ ; \
rm -rf openssl-${OPENSSL_VERSION} ; \
done \
&& rm -fv openssl.tar.gz \
&& pip uninstall -y aqtinstall \
&& pip cache purge \
&& apt autoremove --purge -y ${BUILD_PACKAGES} \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd -r user && useradd --create-home --gid user user && echo 'user ALL=NOPASSWD: ALL' > /etc/sudoers.d/user
USER user
WORKDIR /home/user
ENV HOME=/home/user