Skip to content
This repository was archived by the owner on Feb 15, 2018. It is now read-only.

Commit 6b1f42e

Browse files
author
Sam Xiao
committed
Initial commit to open source android docker container build environment for CI/dev
0 parents  commit 6b1f42e

File tree

4 files changed

+129
-0
lines changed

4 files changed

+129
-0
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

Diff for: Dockerfile

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Android Dockerfile
2+
3+
FROM ubuntu:14.04
4+
5+
MAINTAINER Mobile Builds Eng "[email protected]"
6+
7+
# Sets language to UTF8 : this works in pretty much all cases
8+
ENV LANG en_US.UTF-8
9+
RUN locale-gen $LANG
10+
11+
ENV DOCKER_ANDROID_LANG en_US
12+
ENV DOCKER_ANDROID_DISPLAY_NAME mobileci-docker
13+
14+
# Never ask for confirmations
15+
ENV DEBIAN_FRONTEND noninteractive
16+
17+
# Update apt-get
18+
RUN rm -rf /var/lib/apt/lists/*
19+
RUN apt-get update
20+
RUN apt-get dist-upgrade -y
21+
22+
# Installing packages
23+
RUN apt-get -y install software-properties-common
24+
RUN apt-get -y install bzip2 unzip openssh-client git curl zip wget
25+
RUN apt-get -y install lib32stdc++6 lib32z1 lib32ncurses5 lib32bz2-1.0 --no-install-recommends
26+
RUN apt-get -y install libxslt-dev libxml2-dev
27+
RUN apt-get -y install build-essential
28+
29+
# Update apt
30+
RUN apt-add-repository ppa:openjdk-r/ppa
31+
RUN apt-get update
32+
33+
# Install Java
34+
RUN apt-get -y install openjdk-8-jdk
35+
36+
# Install android sdk
37+
RUN wget https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
38+
RUN tar -xvzf android-sdk_r24.4.1-linux.tgz
39+
RUN mv android-sdk-linux /usr/local/android-sdk
40+
RUN rm android-sdk_r24.4.1-linux.tgz
41+
42+
ENV ANDROID_COMPONENTS tools,platform-tools,android-23,build-tools-23.0.2
43+
44+
# Install Android tools
45+
RUN ( sleep 5 && while [ 1 ]; do sleep 1; echo y; done ) | /usr/local/android-sdk/tools/android update sdk --filter "${ANDROID_COMPONENTS}" --no-ui -a
46+
47+
# Install Android NDK
48+
RUN wget https://dl.google.com/android/ndk/android-ndk-r9d-linux-x86_64.tar.bz2
49+
RUN tar -xvjf android-ndk-r9d-linux-x86_64.tar.bz2
50+
RUN mv android-ndk-r9d /usr/local/android-ndk
51+
RUN rm android-ndk-r9d-linux-x86_64.tar.bz2
52+
53+
# Environment variables
54+
ENV ANDROID_HOME /usr/local/android-sdk
55+
ENV ANDROID_SDK_HOME $ANDROID_HOME
56+
ENV ANDROID_NDK_HOME /usr/local/android-ndk
57+
ENV PATH $PATH:$ANDROID_SDK_HOME/tools
58+
ENV PATH $PATH:$ANDROID_SDK_HOME/platform-tools
59+
ENV PATH $PATH:$ANDROID_NDK_HOME
60+
61+
# Export JAVA_HOME variable
62+
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
63+
64+
# Support Gradle
65+
ENV TERM dumb
66+
ENV JAVA_OPTS "-Xms512m -Xmx1024m"
67+
68+
# Cleaning
69+
RUN apt-get clean
70+
71+
# Fix permissions
72+
RUN chown -R root:root $ANDROID_HOME $ANDROID_SDK_HOME $ANDROID_NDK_HOME
73+
RUN chmod -R a+rx $ANDROID_HOME $ANDROID_SDK_HOME $ANDROID_NDK_HOME
74+
75+
# Creating project directories prepared for build when running
76+
# `docker run`
77+
ENV PROJECT /project
78+
RUN mkdir $PROJECT
79+
WORKDIR $PROJECT
80+
81+
RUN echo "sdk.dir=$ANDROID_HOME" > local.properties

Diff for: LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 Uber Technologies, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Diff for: README.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Android Build on Docker Container
2+
===
3+
4+
5+
### Mac OSX
6+
7+
#### Prerequisites
8+
9+
#### Create container with docker-machine :
10+
11+
$ docker-machine create -d virtualbox --virtualbox-disk-size "200000" --virtualbox-memory 4096 --virtualbox-hostonly-cidr "192.168.90.1/24" default
12+
13+
$ docker-machine upgrade default
14+
15+
16+
#### To build the container image:
17+
18+
$ eval "$(docker-machine env default)"
19+
20+
$ docker build -t uber/android-build-environment .
21+
22+
#### Android Rider Build :
23+
24+
$ cd /path/to/your/android/source/root
25+
26+
$ docker run -i -v $PWD:/project -t uber/android-build-environment /bin/bash /project/ci/build.sh

0 commit comments

Comments
 (0)