-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
56 lines (48 loc) · 2.32 KB
/
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
FROM ubuntu:20.04
# set working directory
RUN mkdir -p /home/android
WORKDIR /home/android
# install Java
# install essential tools
ENV JDK_VERSION=11
RUN apt-get update && \
apt-get dist-upgrade -y && \
apt-get install -y --no-install-recommends lib32gcc1 lib32ncurses6 lib32z1 && \
apt-get install -y --no-install-recommends openjdk-${JDK_VERSION}-jdk && \
apt-get install -y --no-install-recommends curl git wget unzip && \
# install node
curl -fsSL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y --no-install-recommends nodejs && \
apt-get upgrade -qq && \
rm -rf /var/lib/apt/lists/*
# download and install Gradle
# https://services.gradle.org/distributions/
ENV GRADLE_VERSION=6.5
ENV GRADLE_DIST=bin
# set gradle directory for cache
RUN mkdir -p /home/android/.gradle
ENV GRADLE_USER_HOME=/home/android/.gradle
RUN cd /opt && \
wget -q https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-${GRADLE_DIST}.zip && \
unzip gradle*.zip && \
ls -d */ | sed 's/\/*$//g' | xargs -I{} mv {} gradle && \
rm gradle*.zip
# download and install Android SDK
# https://developer.android.com/studio#command-tools
ENV ANDROID_SDK_VERSION="7302050"
ENV ANDROID_SDK_ROOT /opt/android-sdk
RUN mkdir -p ${ANDROID_SDK_ROOT}/cmdline-tools && \
wget -q https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_VERSION}_latest.zip && \
unzip *tools*linux*.zip -d ${ANDROID_SDK_ROOT}/cmdline-tools && \
mv ${ANDROID_SDK_ROOT}/cmdline-tools/cmdline-tools ${ANDROID_SDK_ROOT}/cmdline-tools/tools && \
rm *tools*linux*.zip
# set the environment variables
ENV JAVA_HOME=/usr/lib/jvm/java-${JDK_VERSION}-openjdk-amd64
ENV GRADLE_HOME=/opt/gradle
ENV PATH ${PATH}:${GRADLE_HOME}/bin:${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin:${ANDROID_SDK_ROOT}/cmdline-tools/tools/bin:${ANDROID_SDK_ROOT}/platform-tools:${ANDROID_SDK_ROOT}/emulator
# accept the license agreements of the SDK components
# install sdk components (and uninstall emulator to keep image smaller)
RUN mkdir -p ~/.android/ && touch ~/.android/repositories.cfg && \
yes | sdkmanager --sdk_root=${ANDROID_SDK_ROOT} --licenses && \
sdkmanager --sdk_root=${ANDROID_SDK_ROOT} --install "platform-tools" "build-tools;29.0.3" && \
sdkmanager --sdk_root=${ANDROID_SDK_ROOT} --uninstall emulator