Dockerfile 3.2 KB
Newer Older
Y
yejianwu 已提交
1 2
FROM ubuntu:16.04

Y
yejianwu 已提交
3 4
WORKDIR /

Y
yejianwu 已提交
5 6 7
# Update source
RUN apt-get update -y

Y
yejianwu 已提交
8
# Basic tools
Y
yejianwu 已提交
9
RUN apt-get install -y --no-install-recommends \
Y
yejianwu 已提交
10
    apt-utils \
Y
yejianwu 已提交
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
    build-essential \
    cmake \
    curl \
    git \
    libcurl3-dev \
    libgoogle-glog-dev \
    libfreetype6-dev \
    libpng12-dev \
    libprotobuf-dev \
    libzmq3-dev \
    pkg-config \
    python-dev \
    python-pip \
    protobuf-compiler \
    rsync \
    software-properties-common \
    unzip \
    zip \
    zlib1g-dev \
    openjdk-8-jdk \
    openjdk-8-jre-headless \
Y
yejianwu 已提交
32
    openssh-server \
W
wuchenghui 已提交
33 34
    wget \
    bsdmainutils
Y
yejianwu 已提交
35
RUN pip install --upgrade pip
Y
yejianwu 已提交
36

Y
yejianwu 已提交
37 38 39 40 41 42 43 44 45
# Setup vim
RUN apt-get install -y --no-install-recommends \
    locales \
    vim

RUN locale-gen en_US.UTF-8
ENV LC_CTYPE=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
ENV TERM xterm-256color
B
Bin Li 已提交
46

Y
yejianwu 已提交
47 48 49 50 51 52 53 54 55 56
# Set up Bazel.
# Running bazel inside a `docker build` command causes trouble, cf:
#   https://github.com/bazelbuild/bazel/issues/134
# The easiest solution is to set up a bazelrc file forcing --batch.
RUN echo "startup --batch" >>/etc/bazel.bazelrc
# Similarly, we need to workaround sandboxing issues:
#   https://github.com/bazelbuild/bazel/issues/418
RUN echo "build --spawn_strategy=standalone --genrule_strategy=standalone" \
    >>/etc/bazel.bazelrc
# Install the most recent bazel release.
Y
yejianwu 已提交
57
ENV BAZEL_VERSION 0.13.1
Y
yejianwu 已提交
58 59
RUN mkdir /tmp/bazel && \
    cd /tmp/bazel && \
Y
yejianwu 已提交
60
    wget https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \
Y
yejianwu 已提交
61 62 63
    chmod +x bazel-*.sh && \
    ./bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \
    cd / && \
Y
yejianwu 已提交
64
    rm -rf /tmp/bazel
Y
yejianwu 已提交
65

B
Bin Li 已提交
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
# Install SDK
ENV ANDROID_SDK_VERSION 4333796
ENV ANDROID_BUILD_TOOLS_VERSION 26.0.2
ENV ANDROID_SDK_FILENAME sdk-tools-linux-${ANDROID_SDK_VERSION}.zip
ENV ANDROID_SDK_URL https://dl.google.com/android/repository/${ANDROID_SDK_FILENAME}
ENV ANDROID_API_LEVELS android-26
ENV ANDROID_HOME /opt/sdk
ENV PATH ${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
RUN mkdir -p /opt/sdk && \
    cd /opt && \
    wget -q ${ANDROID_SDK_URL} && \
    unzip ${ANDROID_SDK_FILENAME} -d ${ANDROID_HOME} && \
    rm ${ANDROID_SDK_FILENAME} && \
    yes | android update sdk --no-ui -a --filter tools,platform-tools,${ANDROID_API_LEVELS},build-tools-${ANDROID_BUILD_TOOLS_VERSION}

Y
yejianwu 已提交
81
# Download NDK
82 83 84
RUN cd /opt/ && \
    wget -q https://dl.google.com/android/repository/android-ndk-r15c-linux-x86_64.zip && \
    unzip -q android-ndk-r15c-linux-x86_64.zip && \
Y
yejianwu 已提交
85
    rm -f android-ndk-r15c-linux-x86_64.zip
86

Y
yejianwu 已提交
87
ENV ANDROID_NDK_VERSION r15c
Y
yejianwu 已提交
88
ENV ANDROID_NDK_HOME /opt/android-ndk-${ANDROID_NDK_VERSION}
89 90 91 92

# add to PATH
ENV PATH ${PATH}:${ANDROID_NDK_HOME}

Y
yejianwu 已提交
93
# Install tools
Y
yejianwu 已提交
94 95
RUN apt-get install -y --no-install-recommends \
    android-tools-adb
Y
yejianwu 已提交
96
RUN pip install -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com setuptools
Y
yejianwu 已提交
97 98 99
RUN pip install -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com \
    tensorflow==1.8.0 \
    "numpy>=1.14.0" \
Y
yejianwu 已提交
100 101
    scipy \
    jinja2 \
L
Liangliang He 已提交
102
    pyyaml \
Y
yejianwu 已提交
103 104
    sh==1.12.14 \
    pycodestyle==2.4.0 \
Y
yejianwu 已提交
105
    filelock
Y
yejianwu 已提交
106 107 108 109

# fix docker in docker error: `error while loading shared libraries: libltdl.so.7`
# refer to: https://github.com/jenkinsci/docker/issues/506
RUN apt-get install -y libltdl7