Dockerfile 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. # Java baseimage, for Bazel.
  2. FROM java:8
  3. ENV SYNTAXNETDIR=/opt/tensorflow PATH=$PATH:/root/bin
  4. # Install system packages. This doesn't include everything the TensorFlow
  5. # dockerfile specifies, so if anything goes awry, maybe install more packages
  6. # from there. Also, running apt-get clean before further commands will make the
  7. # Docker images smaller.
  8. RUN mkdir -p $SYNTAXNETDIR \
  9. && cd $SYNTAXNETDIR \
  10. && apt-get update \
  11. && apt-get install -y \
  12. file \
  13. git \
  14. graphviz \
  15. libcurl3-dev \
  16. libfreetype6-dev \
  17. libgraphviz-dev \
  18. liblapack-dev \
  19. libopenblas-dev \
  20. libpng12-dev \
  21. libxft-dev \
  22. python-dev \
  23. python-mock \
  24. python-pip \
  25. python2.7 \
  26. swig \
  27. vim \
  28. zlib1g-dev \
  29. && apt-get clean \
  30. && (rm -f /var/cache/apt/archives/*.deb \
  31. /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true)
  32. # Install common Python dependencies. Similar to above, remove caches
  33. # afterwards to help keep Docker images smaller.
  34. RUN pip install --ignore-installed pip \
  35. && python -m pip install numpy \
  36. && rm -rf /root/.cache/pip /tmp/pip*
  37. RUN python -m pip install \
  38. asciitree \
  39. ipykernel \
  40. jupyter \
  41. matplotlib \
  42. pandas \
  43. protobuf \
  44. scipy \
  45. sklearn \
  46. && python -m ipykernel.kernelspec \
  47. && python -m pip install pygraphviz \
  48. --install-option="--include-path=/usr/include/graphviz" \
  49. --install-option="--library-path=/usr/lib/graphviz/" \
  50. && rm -rf /root/.cache/pip /tmp/pip*
  51. # Installs the latest version of Bazel.
  52. RUN wget --quiet https://github.com/bazelbuild/bazel/releases/download/0.4.3/bazel-0.4.3-installer-linux-x86_64.sh \
  53. && chmod +x bazel-0.4.3-installer-linux-x86_64.sh \
  54. && ./bazel-0.4.3-installer-linux-x86_64.sh \
  55. && rm ./bazel-0.4.3-installer-linux-x86_64.sh
  56. COPY WORKSPACE $SYNTAXNETDIR/syntaxnet/WORKSPACE
  57. COPY tools/bazel.rc $SYNTAXNETDIR/syntaxnet/tools/bazel.rc
  58. COPY tensorflow $SYNTAXNETDIR/syntaxnet/tensorflow
  59. # Compile common TensorFlow targets, which don't depend on DRAGNN / SyntaxNet
  60. # source. This makes it more convenient to re-compile DRAGNN / SyntaxNet for
  61. # development (though not as convenient as the docker-devel scripts).
  62. RUN cd $SYNTAXNETDIR/syntaxnet/tensorflow \
  63. && tensorflow/tools/ci_build/builds/configured CPU \
  64. && cd $SYNTAXNETDIR/syntaxnet \
  65. && bazel build -c opt @org_tensorflow//tensorflow:tensorflow_py
  66. # Build the codez.
  67. WORKDIR $SYNTAXNETDIR/syntaxnet
  68. COPY dragnn $SYNTAXNETDIR/syntaxnet/dragnn
  69. COPY syntaxnet $SYNTAXNETDIR/syntaxnet/syntaxnet
  70. COPY third_party $SYNTAXNETDIR/syntaxnet/third_party
  71. COPY util/utf8 $SYNTAXNETDIR/syntaxnet/util/utf8
  72. RUN bazel build -c opt //dragnn/python:all //dragnn/tools:all
  73. # This makes the IP exposed actually "*"; we'll do host restrictions by passing
  74. # a hostname to the `docker run` command.
  75. COPY tensorflow/tensorflow/tools/docker/jupyter_notebook_config.py /root/.jupyter/
  76. EXPOSE 8888
  77. # This does not need to be compiled, only copied.
  78. COPY examples $SYNTAXNETDIR/syntaxnet/examples
  79. # Todo: Move this earlier in the file (don't want to invalidate caches for now).
  80. RUN jupyter nbextension enable --py --sys-prefix widgetsnbextension
  81. CMD /bin/bash -c "bazel-bin/dragnn/tools/oss_notebook_launcher notebook --debug --notebook-dir=/opt/tensorflow/syntaxnet/examples"