This repository has been archived by the owner on May 18, 2021. It is now read-only.
forked from lukin0110/docker-android-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
86 lines (72 loc) · 3.47 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
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
83
84
85
86
# Android Build Dockerfile for Parafuzo.
#
# This is a fork from:
# https://github.com/lukin0110/docker-android-build
#
# Pull base image.
FROM ubuntu:14.04
MAINTAINER Parafuzo <dev@parafuzo.com>
# Update, upgrade and install packages
RUN \
apt-get update && \
apt-get -y install curl unzip python-software-properties software-properties-common lib32stdc++6 lib32z1
# Install Oracle Java JDK
# https://www.digitalocean.com/community/tutorials/how-to-install-java-on-ubuntu-with-apt-get
# https://github.com/dockerfile/java/blob/master/oracle-java7/Dockerfile
RUN \
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
add-apt-repository -y ppa:webupd8team/java && \
apt-get update && \
apt-get install -y oracle-java7-installer
# Install Android SDK
# https://developer.android.com/sdk/index.html#Other
RUN \
cd /usr/local/ && \
curl -L -O http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz && \
tar xf android-sdk_r24.4.1-linux.tgz && \
rm android-sdk_r24.4.1-linux.tgz
# Install Android NDK
# https://developer.android.com/tools/sdk/ndk/index.html
# https://developer.android.com/ndk/index.html
RUN \
cd /usr/local && \
curl -L -O http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin && \
chmod a+x android-ndk-r10e-linux-x86_64.bin && \
./android-ndk-r10e-linux-x86_64.bin && \
rm -f android-ndk-r10e-linux-x86_64.bin
# Install Gradle
RUN cd /usr/local && \
curl -L https://services.gradle.org/distributions/gradle-2.10-bin.zip -o gradle-2.10-bin.zip && \
unzip gradle-2.10-bin.zip
# Update & Install Android Tools
# Cloud message, billing, licensing, play services, admob, analytics
RUN \
echo y | /usr/local/android-sdk-linux/tools/android update sdk --filter tools --no-ui --force -a && \
echo y | /usr/local/android-sdk-linux/tools/android update sdk --filter platform-tools --no-ui --force -a && \
echo y | /usr/local/android-sdk-linux/tools/android update sdk --filter android-19 --no-ui --force -a && \
echo y | /usr/local/android-sdk-linux/tools/android update sdk --filter android-21 --no-ui --force -a && \
echo y | /usr/local/android-sdk-linux/tools/android update sdk --filter android-22 --no-ui --force -a && \
echo y | /usr/local/android-sdk-linux/tools/android update sdk --filter android-23 --no-ui --force -a && \
echo y | /usr/local/android-sdk-linux/tools/android update sdk --filter extra --no-ui --force -a && \
echo y | /usr/local/android-sdk-linux/tools/android update sdk --all --filter build-tools-23.0.2 --no-ui --force
# Set PATH
ENV ANDROID_HOME=/usr/local/android-sdk-linux ANDROID_NDK_HOME=/usr/local/android-ndk-r10e JAVA_HOME=/usr/lib/jvm/java-7-oracle GRADLE_HOME=/usr/local/gradle-2.5
ENV PATH $PATH:$ANDROID_HOME/tools:$ANDROID_NDK_HOME/platform-tools:$ANDROID_NDK_HOME:$GRADLE_HOME/bin
# Flatten the image
# https://intercityup.com/blog/downsizing-docker-containers.html
# Cleaning APT
RUN \
apt-get remove -y unzip python-software-properties software-properties-common && \
apt-get clean autoclean && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
rm -rf /var/cache/oracle-jdk7-installer
#$ rm -rf /var/lib/{apt,dpkg,cache,log}/
# Define working directory.
RUN mkdir -p /data/app
WORKDIR /data/app
# Define volume: your local app code directory can be mounted here
# Mount with: -v /your/local/directory:/data/app
VOLUME ["/data/app"]
# Define default command
CMD ["bash"]