Dockerfile 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # Java baseimage, for Bazel.
  2. FROM openjdk: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. && python -m jupyter_core.command nbextension enable \
  51. --py --sys-prefix widgetsnbextension \
  52. && rm -rf /root/.cache/pip /tmp/pip*
  53. # Installs the latest version of Bazel.
  54. RUN wget --quiet https://github.com/bazelbuild/bazel/releases/download/0.4.3/bazel-0.4.3-installer-linux-x86_64.sh \
  55. && chmod +x bazel-0.4.3-installer-linux-x86_64.sh \
  56. && ./bazel-0.4.3-installer-linux-x86_64.sh \
  57. && rm ./bazel-0.4.3-installer-linux-x86_64.sh
  58. COPY WORKSPACE $SYNTAXNETDIR/syntaxnet/WORKSPACE
  59. COPY tools/bazel.rc $SYNTAXNETDIR/syntaxnet/tools/bazel.rc
  60. COPY tensorflow $SYNTAXNETDIR/syntaxnet/tensorflow
  61. # Compile common TensorFlow targets, which don't depend on DRAGNN / SyntaxNet
  62. # source. This makes it more convenient to re-compile DRAGNN / SyntaxNet for
  63. # development (though not as convenient as the docker-devel scripts).
  64. RUN cd $SYNTAXNETDIR/syntaxnet/tensorflow \
  65. && tensorflow/tools/ci_build/builds/configured CPU \
  66. && cd $SYNTAXNETDIR/syntaxnet \
  67. && bazel build -c opt @org_tensorflow//tensorflow:tensorflow_py
  68. # Build the codez.
  69. WORKDIR $SYNTAXNETDIR/syntaxnet
  70. COPY dragnn $SYNTAXNETDIR/syntaxnet/dragnn
  71. COPY syntaxnet $SYNTAXNETDIR/syntaxnet/syntaxnet
  72. COPY third_party $SYNTAXNETDIR/syntaxnet/third_party
  73. COPY util/utf8 $SYNTAXNETDIR/syntaxnet/util/utf8
  74. RUN bazel build -c opt //dragnn/python:all //dragnn/tools:all
  75. # This makes the IP exposed actually "*"; we'll do host restrictions by passing
  76. # a hostname to the `docker run` command.
  77. COPY tensorflow/tensorflow/tools/docker/jupyter_notebook_config.py /root/.jupyter/
  78. EXPOSE 8888
  79. # This does not need to be compiled, only copied.
  80. COPY examples $SYNTAXNETDIR/syntaxnet/examples
  81. # Todo: Move this earlier in the file (don't want to invalidate caches for now).
  82. CMD /bin/bash -c "bazel-bin/dragnn/tools/oss_notebook_launcher notebook --debug --notebook-dir=/opt/tensorflow/syntaxnet/examples"