Dockerfile.android 1.8 KB
Newer Older
1 2 3 4 5 6
FROM ubuntu:16.04
MAINTAINER PaddlePaddle Authors <paddle-dev@baidu.com>

ARG UBUNTU_MIRROR
RUN /bin/bash -c 'if [[ -n ${UBUNTU_MIRROR} ]]; then sed -i 's#http://archive.ubuntu.com/ubuntu#${UBUNTU_MIRROR}#g' /etc/apt/sources.list; fi'

7 8
# ENV variables
ARG ANDROID_ABI
9
ARG ANDROID_API
10 11

ENV ANDROID_ABI=${ANDROID_ABI:-"armeabi-v7a"}
12
ENV ANDROID_API=${ANDROID_API:-21}
13

14 15
ENV HOME=/root \
    ANDROID_NDK_HOME=/opt/android-ndk-linux \
16
    ANDROID_TOOLCHAINS_DIR=/opt/toolchains
17 18

RUN apt-get update && \
L
Liu Yiqun 已提交
19 20 21
    apt-get install -y \
    git python-dev python-pip python-numpy \
    wget curl tar unzip gcc g++ locales clang-format-3.8 swig cmake && \
22 23
    apt-get clean -y

24
# Install Go and glide
25 26
RUN wget -qO- go.tgz https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz | \
    tar -xz -C /usr/local && \
27 28
    mkdir /root/gopath && \
    mkdir /root/gopath/bin && \
29
    mkdir /root/gopath/src
30 31 32 33
ENV GOROOT=/usr/local/go GOPATH=/root/gopath
# should not be in the same line with GOROOT definition, otherwise docker build could not find GOROOT.
ENV PATH=${PATH}:${GOROOT}/bin:${GOPATH}/bin

34 35 36 37 38 39
# git credential to skip password typing
RUN git config --global credential.helper store

# Fix locales to en_US.UTF-8
RUN localedef -i en_US -f UTF-8 en_US.UTF-8

L
Liu Yiqun 已提交
40 41 42 43
RUN pip install --upgrade pip && \
    pip install -U 'protobuf==3.1.0' && \
    pip install -U wheel sphinx && \
    pip install pre-commit
44 45

# Android NDK
46 47
RUN mkdir -p ${ANDROID_TOOLCHAINS_DIR} && \
    mkdir -p /opt/android-ndk-tmp && \
48 49 50 51
    cd /opt/android-ndk-tmp && \
    wget -q https://dl.google.com/android/repository/android-ndk-r14b-linux-x86_64.zip && \
    unzip -q android-ndk-r14b-linux-x86_64.zip && \
    mv android-ndk-r14b ${ANDROID_NDK_HOME} && \
52
    rm -rf /opt/android-ndk-tmp
53

L
Liu Yiqun 已提交
54
CMD ["bash", "/paddle/paddle/scripts/docker/build_android.sh"]