Dockerfile 4.94 KB
Newer Older
Daniele Venzano's avatar
Daniele Venzano committed
1 2 3 4 5 6 7 8 9 10
FROM ubuntu:14.04

MAINTAINER Pietro Michiardi <Pietro.Michiardi@eurecom.fr>

ENV DEBIAN_FRONTEND noninteractive

##################################################
# BASELINE
##################################################
RUN apt-get update && apt-get install -y --force-yes --no-install-recommends \
11 12
    python3-pip \
    python3-dev \
Daniele Venzano's avatar
Daniele Venzano committed
13 14 15 16 17 18 19 20 21 22 23 24
    software-properties-common \
    curl \
    pkg-config \
    zip \
    g++ \
    zlib1g-dev \
    unzip \
    swig \
    git \
    swig \
    && apt-get clean

25
RUN python3 -m pip install --upgrade pip
Daniele Venzano's avatar
Daniele Venzano committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48

##################################################
# JAVA
##################################################
RUN add-apt-repository ppa:webupd8team/java -y
RUN /bin/echo debconf shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
RUN apt-get update && apt-get install -y oracle-java8-installer

##################################################
# TENSORFLOW
##################################################
# From sources

# INSTALL BAZEL
RUN echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list
RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add -

RUN apt-get update && sudo apt-get install -y --force-yes --no-install-recommends bazel patch
RUN apt-get upgrade -y --force-yes --no-install-recommends bazel

##################################################
# Make sure important packages are installed
##################################################
49
RUN pip3 install --upgrade numpy pandas matplotlib
Daniele Venzano's avatar
Daniele Venzano committed
50

51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
# 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.
ENV BAZEL_VERSION 0.5.0
WORKDIR /
RUN mkdir /bazel && \
    cd /bazel && \
    curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -O https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \
    curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -o /bazel/LICENSE.txt https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE && \
    chmod +x bazel-*.sh && \
    ./bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \
    cd / && \
    rm -f /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh

# Download and build TensorFlow.

RUN git clone https://github.com/tensorflow/tensorflow.git && \
74
    cd tensorflow && \
75
    git checkout r1.3
76 77 78 79 80 81
WORKDIR /tensorflow

# TODO(craigcitro): Don't install the pip package, since it makes it
# more difficult to experiment with local changes. Instead, just add
# the built directory to the path.

82
ENV CI_BUILD_PYTHON python3
83

84
RUN pip3 --no-cache-dir install wheel
Daniele Venzano's avatar
Daniele Venzano committed
85

86
RUN sed -i '\@https://github.com/google/protobuf/archive/0b059a3d8a8f8aa40dde7bea55edca4ec5dfea66.tar.gz@d' tensorflow/workspace.bzl
87 88 89 90
RUN tensorflow/tools/ci_build/builds/configured CPU \
    bazel build -c opt --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" \
        tensorflow/tools/pip_package:build_pip_package && \
    bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/pip && \
91
    pip3 --no-cache-dir install --upgrade /tmp/pip/tensorflow-*.whl && \
92 93 94 95
    rm -rf /tmp/pip && \
    rm -rf /root/.cache
# Clean up pip wheel and Bazel cache when done.

Daniele Venzano's avatar
Daniele Venzano committed
96
# COMPILE AND INSTALL PIP PACKAGE
97
#COPY files/conf.txt /tmp/conf.txt
Daniele Venzano's avatar
Daniele Venzano committed
98

99 100 101 102 103
#RUN ./configure < /tmp/conf.txt 
#RUN bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
#RUN pip install wheel
#RUN bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
#RUN pip install /tmp/tensorflow_pkg/tensorflow-*.whl
Daniele Venzano's avatar
Daniele Venzano committed
104 105 106 107

##################################################
# GPy
##################################################
108
RUN pip3 install --upgrade GPy paramz
Daniele Venzano's avatar
Daniele Venzano committed
109 110 111 112 113 114 115

##################################################
# GPFlow
##################################################
WORKDIR /opt
RUN git clone https://github.com/GPflow/GPflow.git
WORKDIR /opt/GPflow
116
RUN python3 setup.py install
Daniele Venzano's avatar
Daniele Venzano committed
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140

##################################################
# SETUP ZOE APP
##################################################
# Configure environment
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle/
ENV SHELL /bin/bash
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8

# Configure container startup as root
EXPOSE 6006
WORKDIR /mnt/workspace
ENV WS_DIR /mnt/workspace
#COPY files/start-tf.sh /usr/local/bin/
#CMD ["/usr/local/bin/start-tf.sh"]
#RUN chmod 755 /usr/local/bin/start-tf.sh
#ADD files/* /usr/local/bin/
#RUN chmod +x /usr/local/bin/*
#ENTRYPOINT ["/usr/local/bin/start-tf.sh"]