Public Repository

Last pushed: 7 months ago
Short Description
Create Android APK from sources using Gradle and Android Tools
Full Description

Run with:
docker run --rm -v $PWD:/data rovermars/apkbuilder gradle clean build

Dockerfile:
FROM ubuntu
MAINTAINER rovermars rovermars@gmail.com

ENV SDK_HOME /opt

RUN apt-get --quiet update --yes
RUN apt-get --quiet install --yes \
wget \
unzip \
tar \
lib32stdc++6 \
lib32z1 \
git \
openssl \
ssh \
software-properties-common \
curl \
lib32ncurses5 \
lib32z1 \
junit4 \
--no-install-recommends

Java installation

RUN \
echo oracle-java8-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-java8-installer && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/oracle-jdk8-installer

Define working directory.

WORKDIR /data

Define commonly used JAVA_HOME variable

ENV JAVA_HOME /usr/lib/jvm/java-8-oracle

Gradle

ENV GRADLE_VERSION 2.14.1
ENV GRADLE_SDK_URL https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-all.zip
RUN curl -sSL "${GRADLE_SDK_URL}" -o gradle-${GRADLE_VERSION}-all.zip && \
unzip gradle-${GRADLE_VERSION}-all.zip -d ${SDK_HOME} && \
rm -rf gradle-${GRADLE_VERSION}-all.zip
ENV GRADLE_HOME ${SDK_HOME}/gradle-${GRADLE_VERSION}
ENV PATH ${GRADLE_HOME}/bin:$PATH

Android sdk

ENV ANDROID_COMMANDLINE_TOOLS="24.4.1" \
ANDROID_SDK="android-24,android-25" \
ANDROID_BUILD_TOOLS="build-tools-24.0.0,build-tools-24.0.1,build-tools-24.0.2,build-tools-24.0.3"

RUN cd /opt && \
wget --no-check-certificate https://dl.google.com/android/android-sdk_r${ANDROID_COMMANDLINE_TOOLS}-linux.tgz && \
tar -zxvf android-sdk_r${ANDROID_COMMANDLINE_TOOLS}-linux.tgz && \
rm -rf android-sdk_r${ANDROID_COMMANDLINE_TOOLS}-linux.tgz

RUN echo y | /opt/android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter "${ANDROID_SDK}" && \
echo y | /opt/android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter platform-tools && \
echo y | /opt/android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter "${ANDROID_BUILD_TOOLS}" && \
echo y | /opt/android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra

ENV ANDROID_HOME=${SDK_HOME}/android-sdk-linux"
ENV PATH="${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:$PATH"
RUN . /etc/profile

Docker Pull Command
Owner
rovermars

Comments (0)