Skip to content

Instantly share code, notes, and snippets.

@MisterRager
Created May 8, 2017 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MisterRager/e2af2178b8f6171aab85af0f4e2e19b5 to your computer and use it in GitHub Desktop.
Save MisterRager/e2af2178b8f6171aab85af0f4e2e19b5 to your computer and use it in GitHub Desktop.
Dockerfile for JDK 7 android builds
# Start with JDK7
FROM java:7-jdk
# Init dependencies for the setup process
RUN dpkg --add-architecture i386 \
&& apt-get update \
&& apt-get install -y \
software-properties-common \
python-software-properties \
unzip \
wget \
# Install 32-bit compatibility for 64-bit environments
libc6:i386 \
libncurses5:i386 \
libstdc++6:i386 \
zlib1g:i386 \
# Cleanup
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# 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.3.3-linux.tgz && \
tar xf android-sdk_r24.3.3-linux.tgz && \
rm android-sdk_r24.3.3-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.5-bin.zip -o gradle-2.5-bin.zip && \
unzip gradle-2.5-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 extra --no-ui --force -a
# 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 curl unzip python-software-properties software-properties-common && \
apt-get clean autoclean && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment