Dockerfile 3.46 KB
Newer Older
1
FROM ubuntu:16.10
2
3
4

ENV SYNTAXNETDIR=/opt/tensorflow PATH=$PATH:/root/bin

Ivan Bogatyy's avatar
Ivan Bogatyy committed
5
6
7
8
# Install system packages. This doesn't include everything the TensorFlow
# dockerfile specifies, so if anything goes awry, maybe install more packages
# from there. Also, running apt-get clean before further commands will make the
# Docker images smaller.
9
10
11
RUN mkdir -p $SYNTAXNETDIR \
    && cd $SYNTAXNETDIR \
    && apt-get update \
Ivan Bogatyy's avatar
Ivan Bogatyy committed
12
13
14
15
16
17
18
19
20
    && apt-get install -y \
          file \
          git \
          graphviz \
          libcurl3-dev \
          libfreetype6-dev \
          libgraphviz-dev \
          liblapack-dev \
          libopenblas-dev \
Mathias Deschamps's avatar
Mathias Deschamps committed
21
          libpng-dev \
Ivan Bogatyy's avatar
Ivan Bogatyy committed
22
          libxft-dev \
23
          openjdk-8-jdk \
Ivan Bogatyy's avatar
Ivan Bogatyy committed
24
25
26
27
28
          python-dev \
          python-mock \
          python-pip \
          python2.7 \
          swig \
29
          unzip \
Ivan Bogatyy's avatar
Ivan Bogatyy committed
30
          vim \
31
          wget \
Ivan Bogatyy's avatar
Ivan Bogatyy committed
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
          zlib1g-dev \
    && apt-get clean \
    && (rm -f /var/cache/apt/archives/*.deb \
        /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true)

# Install common Python dependencies. Similar to above, remove caches
# afterwards to help keep Docker images smaller.
RUN pip install --ignore-installed pip \
    && python -m pip install numpy \
    && rm -rf /root/.cache/pip /tmp/pip*
RUN python -m pip install \
          asciitree \
          ipykernel \
          jupyter \
          matplotlib \
          pandas \
          protobuf \
          scipy \
          sklearn \
    && python -m ipykernel.kernelspec \
    && python -m pip install pygraphviz \
          --install-option="--include-path=/usr/include/graphviz" \
          --install-option="--library-path=/usr/lib/graphviz/" \
Ivan Bogatyy's avatar
Ivan Bogatyy committed
55
56
    && python -m jupyter_core.command nbextension enable \
          --py --sys-prefix widgetsnbextension \
Ivan Bogatyy's avatar
Ivan Bogatyy committed
57
58
    && rm -rf /root/.cache/pip /tmp/pip*

59
# Installs Bazel.
60
61
62
63
RUN wget --quiet https://github.com/bazelbuild/bazel/releases/download/0.8.1/bazel-0.8.1-installer-linux-x86_64.sh \
    && chmod +x bazel-0.8.1-installer-linux-x86_64.sh \
    && ./bazel-0.8.1-installer-linux-x86_64.sh \
    && rm ./bazel-0.8.1-installer-linux-x86_64.sh
Ivan Bogatyy's avatar
Ivan Bogatyy committed
64
65
66
67
68
69
70
71
72

COPY WORKSPACE $SYNTAXNETDIR/syntaxnet/WORKSPACE
COPY tools/bazel.rc $SYNTAXNETDIR/syntaxnet/tools/bazel.rc
COPY tensorflow $SYNTAXNETDIR/syntaxnet/tensorflow

# Compile common TensorFlow targets, which don't depend on DRAGNN / SyntaxNet
# source. This makes it more convenient to re-compile DRAGNN / SyntaxNet for
# development (though not as convenient as the docker-devel scripts).
RUN cd $SYNTAXNETDIR/syntaxnet/tensorflow \
73
    && tensorflow/tools/ci_build/builds/configured CPU \
Ivan Bogatyy's avatar
Ivan Bogatyy committed
74
75
    && cd $SYNTAXNETDIR/syntaxnet \
    && bazel build -c opt @org_tensorflow//tensorflow:tensorflow_py
76

Ivan Bogatyy's avatar
Ivan Bogatyy committed
77
78
79
80
81
82
83
# Build the codez.
WORKDIR $SYNTAXNETDIR/syntaxnet
COPY dragnn $SYNTAXNETDIR/syntaxnet/dragnn
COPY syntaxnet $SYNTAXNETDIR/syntaxnet/syntaxnet
COPY third_party $SYNTAXNETDIR/syntaxnet/third_party
COPY util/utf8 $SYNTAXNETDIR/syntaxnet/util/utf8
RUN bazel build -c opt //dragnn/python:all //dragnn/tools:all
84

Ivan Bogatyy's avatar
Ivan Bogatyy committed
85
86
87
88
# This makes the IP exposed actually "*"; we'll do host restrictions by passing
# a hostname to the `docker run` command.
COPY tensorflow/tensorflow/tools/docker/jupyter_notebook_config.py /root/.jupyter/
EXPOSE 8888
89

Ivan Bogatyy's avatar
Ivan Bogatyy committed
90
91
92
# This does not need to be compiled, only copied.
COPY examples $SYNTAXNETDIR/syntaxnet/examples
# Todo: Move this earlier in the file (don't want to invalidate caches for now).
93

94
CMD /bin/bash -c "bazel-bin/dragnn/tools/oss_notebook_launcher notebook --debug --notebook-dir=/opt/tensorflow/syntaxnet/examples"