forked from realm/realm-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.android
60 lines (53 loc) · 2.28 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
# Starting from a slimmed version of the latest stable Debian
FROM debian:stable-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=r10e
ARG ANDROID_BUILD_TOOLS_VERSION=28.0.3
ARG NODE_VERSION=10.x
# Locales
ENV LANG C.UTF-8
# Because we're using the slim variant of Debian some directories (expected when installing openjdk) are missing
RUN mkdir /usr/share/man/man1
# 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 \
# Tools ndeed when building Android module
build-essential \
&& \
# 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 as jenkins
USER jenkins
# Install the Android SDK and NDK
ENV ANDROID_HOME /home/jenkins/android-sdk
ENV PATH ${PATH}:${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 "tools" "platform-tools" "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" "platforms;android-26" && \
\
echo 'Installing Android NDK' && \
cd ${ANDROID_NDK}/.. && \
curl -sO http://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip && \
unzip -q android-ndk-*-linux-x86_64.zip && \
rm android-ndk-*-linux-x86_64.zip && \
mv android-ndk-* android-ndk