1 # This image can be used to build an Android app using the NDK, since $ANDROID_HOME is set. 2 # The only "Skia-specific" thing is the depot_tools, everything else is pretty generic. 3 # 4 # The base Docker image (butomo1989/docker-android-x86-8.1:1.4-p1) has an android emulator 5 # that can be run by doing the following 6 # docker run --privileged -d --name android_em -e DEVICE="Samsung Galaxy S6" butomo1989/docker-android-x86-8.1:1.4-p1 7 # Then, the running container can be attached to by: 8 # docker exec -it android_em /bin/bash 9 # Of course, this Docker image can also do that, it's just a bit heavier for "emulation only" 10 # tasks. 11 12 FROM butomo1989/docker-android-x86-8.1:1.4-p1 13 14 RUN apt-get update && apt-get upgrade -y && \ 15 apt-get install -y \ 16 clang-6.0 \ 17 git \ 18 python 19 20 RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /opt/depot_tools 21 22 WORKDIR /root 23 24 RUN wget -O /root/android-ndk-r18-linux-x86_64.zip https://storage.googleapis.com/skia-cdn/android-sdk/android-ndk-r18-linux-x86_64.zip && \ 25 unzip /root/android-ndk-r18-linux-x86_64.zip && \ 26 rm -f /root/android-ndk-r18-linux-x86_64.zip 27 28 # "yes" agrees to the license. (You might think it's waiting for input, but it's not.) 29 RUN yes | sdkmanager ndk-bundle "lldb;3.1" "cmake;3.6.4111459" 30 31 RUN update-alternatives --install /usr/bin/cc cc /usr/lib/llvm-6.0/bin/clang 20 && \ 32 update-alternatives --install /usr/bin/c++ c++ /usr/lib/llvm-6.0/bin/clang++ 20 33 34 ENV CC="/usr/lib/llvm-6.0/bin/clang" \ 35 CXX="/usr/lib/llvm-6.0/bin/clang++" \ 36 PATH=/usr/lib/llvm-6.0/bin:$PATH 37 38 ENV PATH=$PATH:/opt/depot_tools 39 40 ENV ANDROID_NDK=/root/android-ndk-r18 41