Dockerfile 4.8 KB
Newer Older
Daniele Venzano's avatar
Daniele Venzano committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
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 \
    python-pip \
    python-dev \
    software-properties-common \
    curl \
    pkg-config \
    zip \
    g++ \
    zlib1g-dev \
    unzip \
    swig \
    git \
    swig \
    && apt-get clean

RUN python -m pip install --upgrade pip

##################################################
# 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
##################################################
RUN pip install --upgrade numpy pandas matplotlib

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 && \
Daniele Venzano's avatar
Daniele Venzano committed
74
    cd tensorflow
75
    git checkout r1.3
76 77 78 79 80 81 82 83
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.

ENV CI_BUILD_PYTHON python

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

86 87 88 89 90 91 92 93 94
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 && \
    pip --no-cache-dir install --upgrade /tmp/pip/tensorflow-*.whl && \
    rm -rf /tmp/pip && \
    rm -rf /root/.cache
# Clean up pip wheel and Bazel cache when done.

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

98 99 100 101 102
#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
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139

##################################################
# GPy
##################################################
RUN pip install --upgrade GPy paramz

##################################################
# GPFlow
##################################################
WORKDIR /opt
RUN git clone https://github.com/GPflow/GPflow.git
WORKDIR /opt/GPflow
RUN python setup.py install

##################################################
# 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"]