Created
October 23, 2018 01:25
-
-
Save davidtcdeveloper/bb61ebe71de129da1bbe29e8ca070bb4 to your computer and use it in GitHub Desktop.
File for creating an image for Android applications build.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dockerfile for Android app build. Can be used for native Android builds. | |
# | |
# Before building, you need to replace the values of variables | |
# ANDROID_SDK_LICENSE and ANDROID_SDK_PREVIEW_LICENSE (lines 70 and 71). | |
# Replace these values with contents of files android-sdk-license | |
# and android-sdk-preview-license that can be found at ANDROID_SDK/licenses. | |
# The line breakes are mandatory, use \n to add them. | |
FROM ubuntu:16.04 | |
# Never ask for confirmations | |
ENV DEBIAN_FRONTEND noninteractive | |
# Update apt-get | |
RUN rm -rf /var/lib/apt/lists/* | |
RUN apt-get update | |
RUN apt-get dist-upgrade -y | |
# Installing packages | |
RUN apt-get install -y \ | |
autoconf \ | |
build-essential \ | |
bzip2 \ | |
curl \ | |
gcc \ | |
git \ | |
groff \ | |
lib32stdc++6 \ | |
lib32z1 \ | |
lib32ncurses5 \ | |
m4 \ | |
openssh-client \ | |
pkg-config \ | |
software-properties-common \ | |
unzip \ | |
wget \ | |
zip \ | |
--no-install-recommends | |
# Install Java | |
RUN apt-add-repository ppa:openjdk-r/ppa | |
RUN apt-get update | |
RUN apt-get -y install openjdk-8-jdk | |
# Export JAVA_HOME variable | |
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/ | |
# Clean Up Apt-get | |
RUN rm -rf /var/lib/apt/lists/* | |
RUN apt-get clean | |
# Install Android SDK | |
RUN wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip | |
RUN unzip sdk-tools-linux-4333796 | |
RUN mkdir android-sdk-linux | |
RUN mv tools android-sdk-linux/tools | |
RUN rm sdk-tools-linux-4333796.zip | |
ENV ANDROID_COMPONENTS platform-tools,android-28,build-tools-28.0.1,build-tools-28.0.0 | |
# Environment variables | |
ENV ANDROID_HOME /android-sdk-linux | |
ENV ANDROID_SDK_HOME $ANDROID_HOME | |
ENV JENKINS_HOME $HOME | |
ENV PATH ${INFER_HOME}/bin:${PATH} | |
ENV PATH $PATH:$ANDROID_SDK_HOME/tools | |
ENV PATH $PATH:$ANDROID_SDK_HOME/platform-tools | |
ENV PATH $PATH:$ANDROID_SDK_HOME/build-tools/23.0.2 | |
ENV PATH $PATH:$ANDROID_SDK_HOME/build-tools/24.0.0 | |
RUN echo "sdk.dir=$ANDROID_HOME" > local.properties | |
# Accepts licences | |
ENV ANDROID_SDK_LICENSE "YOUR LICENSE HERE" | |
ENV ANDROID_SDK_PREVIEW_LICENSE "YOUR LICENSE HERE" | |
RUN mkdir $ANDROID_SDK_HOME/licenses | |
RUN printf $ANDROID_SDK_LICENSE > $ANDROID_SDK_HOME/licenses/android-sdk-license | |
RUN printf $ANDROID_SDK_PREVIEW_LICENSE > $ANDROID_SDK_HOME/licenses/android-sdk-preview-license | |
# Install Android tools | |
RUN echo y | $ANDROID_HOME/tools/android update sdk --filter "${ANDROID_COMPONENTS}" --no-ui -a | |
# Cleaning | |
RUN apt-get clean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment