-
Notifications
You must be signed in to change notification settings - Fork 577
/
Dockerfile.android
82 lines (73 loc) · 2.92 KB
/
Dockerfile.android
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
81
82
# Starting from a slimmed version of the latest stable Debian
FROM debian:stretch-20210927-slim
# Setting environment variables for versions
# See https://developer.android.com/studio/#command-tools for the latest SDK version
ARG ANDROID_SDK_VERSION=4333796
ARG ANDROID_NDK_VERSION=r23c
ARG ANDROID_BUILD_TOOLS_VERSION=28.0.3
ARG NODE_VERSION=16.x
# Locales
ENV LANG C.UTF-8
ENV NPM_CONFIG_UNSAFE_PERM true
ENV NVM_DIR /tmp/.nvm
# Install dependencies
ENV DEBIAN_FRONTEND noninteractive
RUN dpkg --add-architecture i386 && \
apt-get update -qq && \
apt-get install -qq -y \
# Installing OpenJDK in its headless variant as we don't need the GUI related parts
openjdk-8-jdk-headless \
# Tools needed when installing dependencies
curl \
gnupg \
unzip \
git \
qemu-kvm \
libglu1 \
# Tools ndeed when building Android module
build-essential \
ninja-build \
&& \
# Install the active LTS version of Node.js
curl -sL https://deb.nodesource.com/setup_${NODE_VERSION} | bash - && \
apt-get install -qq -y nodejs && \
# Clean-up to lower the image size
apt-get clean
# Jenkins will run this image as user 1001, let's ensure that user exists and has a home directory
RUN adduser --uid 1001 --disabled-password --gecos "" jenkins
# Install the SDK and NDK
USER jenkins
# Install the Android SDK and NDK
ENV ANDROID_HOME /home/jenkins/android-sdk
ENV PATH ${PATH}:${ANDROID_HOME}/emulator:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
ENV ANDROID_NDK /home/jenkins/android-ndk
RUN echo 'Installing Android SDK' && \
mkdir -p ${ANDROID_HOME} && cd ${ANDROID_HOME} && \
curl -sO https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_VERSION}.zip && \
unzip -q sdk-tools-linux-*.zip && \
rm sdk-tools-linux-*.zip && \
sdkmanager --update && \
yes | sdkmanager --licenses && \
yes | sdkmanager "tools" \
"platform-tools" \
"build-tools;${ANDROID_BUILD_TOOLS_VERSION}" \
"platforms;android-26" \
"system-images;android-29;default;x86" && \
\
echo 'Installing Android NDK' && \
cd ${ANDROID_NDK}/.. && \
curl -sO http://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux.zip && \
unzip -q android-ndk-*-linux.zip && \
rm android-ndk-*-linux.zip && \
mv android-ndk-* android-ndk
RUN mkdir -p $NVM_DIR \
&& curl -s https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash \
&& . $NVM_DIR/nvm.sh \
&& nvm install 16 \
&& chmod a+rwX -R $NVM_DIR
# Ensure a new enough version of CMake is available.
RUN mkdir -p /home/jenkins/cmake && \
cd /home/jenkins/cmake && \
curl -O -J https://cmake.org/files/v3.23/cmake-3.23.2-linux-x86_64.tar.gz &&\
tar zxf cmake-3.23.2-linux-x86_64.tar.gz
ENV PATH "/home/jenkins/cmake/cmake-3.23.2-linux-x86_64/bin:$PATH"