Skip to content

Instantly share code, notes, and snippets.

@tshrkmd
Last active July 16, 2017 11:50
Show Gist options
  • Save tshrkmd/acc18f4f23e610c24546789080048c7a to your computer and use it in GitHub Desktop.
Save tshrkmd/acc18f4f23e610c24546789080048c7a to your computer and use it in GitHub Desktop.
android build image
# based on https://registry.hub.docker.com/u/samtstern/android-sdk/dockerfile/ with openjdk-8
FROM java:8
MAINTAINER Toshihiro.Kamada <[email protected]>
ENV DEBIAN_FRONTEND noninteractive
# Install dependencies
RUN dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -yq libc6:i386 libstdc++6:i386 zlib1g:i386 libncurses5:i386 zip lib32stdc++6 lib32z1 --no-install-recommends && \
apt-get clean
# Download and untar SDK
ENV ANDROID_HOME /usr/local/android-sdk-linux
ENV ANDROID_SDK_VERSION r25.2.5
RUN curl -L https://dl.google.com/android/repository/tools_${ANDROID_SDK_VERSION}-linux.zip -o tools_${ANDROID_SDK_VERSION}-linux.zip \
&& unzip -q tools_${ANDROID_SDK_VERSION}-linux.zip -d ${ANDROID_HOME} \
&& rm -rf tools_${ANDROID_SDK_VERSION}-linux.zip
ENV PATH ${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${PATH}
# Install Android SDK components
ENV ANDROID_COMPONENTS platform-tools,build-tools-25.0.3,android-19,android-22,android-23,android-25
ENV GOOGLE_COMPONENTS extra-android-m2repository,extra-google-m2repository
RUN echo y | android update sdk --no-ui --all --filter "${ANDROID_COMPONENTS}","${GOOGLE_COMPONENTS}"
# Android Cmake
RUN curl -L https://dl.google.com/android/repository/cmake-3.6.3155560-linux-x86_64.zip -o android-cmake.zip \
&& unzip -q android-cmake.zip -d ${ANDROID_HOME}/cmake \
&& rm -rf android-cmake.zip \
&& chmod u+x ${ANDROID_HOME}/cmake/bin/ -R
ENV PATH ${PATH}:${ANDROID_HOME}/cmake/bin
# Download and unzip NDK
ENV ANDROID_NDK_VERSION r13b
ENV ANDROID_NDK_HOME /usr/local/android-ndk-${ANDROID_NDK_VERSION}
RUN curl -L http://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip -o android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip \
&& unzip -q android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip -d /usr/local \
&& rm -rf android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip \
&& chmod u+x ${ANDROID_NDK_HOME}/ -R
ENV PATH ${ANDROID_NDK_HOME}:${PATH}
# ライセンスの追加
RUN mkdir ${ANDROID_HOME}/licenses || true
RUN echo 8933bad161af4178b1185d1a37fbf41ea5269c55 >> ${ANDROID_HOME}/licenses/android-sdk-license
#RUN echo 84831b9409646a918e30573bab4c9c91346d8abd >> ${ANDROID_HOME}/licenses/android-sdk-preview-license
# Support Gradle
ENV TERM dumb
ENV JAVA_OPTS -Xms256m -Xmx512m
# WORKSPACE
RUN mkdir /workspace
WORKDIR /workspace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment