Dockerfile 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. FROM ubuntu:18.04
  2. ENV GOPATH /root
  3. ENV PROTOBUF_VERSION 3.5.1
  4. COPY . /root/src/gopkg.in/src-d/hercules.v7
  5. RUN apt-get update && \
  6. apt-get install -y --no-install-suggests --no-install-recommends software-properties-common && \
  7. add-apt-repository -y ppa:gophers/archive && \
  8. apt-get update && \
  9. apt-get install -y --no-install-suggests --no-install-recommends locales golang-1.10-go python3 python3-dev python3-distutils libyaml-dev libyaml-0-2 libxml2-dev libxml2 curl git make unzip g++ && \
  10. curl -SLo protoc.zip https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-linux-x86_64.zip && \
  11. unzip -d /usr/local protoc.zip && rm protoc.zip && \
  12. locale-gen en_US.UTF-8 && \
  13. export PATH=/usr/lib/go-1.10/bin:/root/bin:$PATH && \
  14. go get -v github.com/golang/dep/cmd/dep && \
  15. cd /root/src/gopkg.in/src-d/hercules.v7 && \
  16. export CGO_CXXFLAGS=-std=c++14 && \
  17. curl -L "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-$(go env GOOS)-x86_64-1.7.0.tar.gz" | tar -C /usr/local -xz && \
  18. make && \
  19. rm /usr/local/bin/protoc && rm /usr/local/readme.txt && rm -rf /usr/local/include/google && \
  20. cp /root/bin/hercules /usr/local/bin && \
  21. cp -r /root/src/gopkg.in/src-d/hercules.v7/*.py /root/src/gopkg.in/src-d/hercules.v7/internal /usr/local/bin && \
  22. sed -i 's/parser.add_argument("--backend",/parser.add_argument("--backend", default="Agg",/' /usr/local/bin/labours.py && \
  23. echo '#!/bin/bash\n\
  24. \n\
  25. echo\n\
  26. echo " $@"\n\
  27. echo\n\' > /browser && \
  28. chmod +x /browser && \
  29. curl https://bootstrap.pypa.io/get-pip.py | python3 - pip==18.1 && \
  30. pip3 install --no-cache-dir --no-build-isolation cython && \
  31. pip3 install --no-cache-dir --no-build-isolation -r /root/src/gopkg.in/src-d/hercules.v7/requirements.txt https://github.com/mind/wheels/releases/download/tf1.7-cpu/tensorflow-1.7.0-cp36-cp36m-linux_x86_64.whl && \
  32. rm -rf /root/* && \
  33. apt-get remove -y software-properties-common golang-1.10-go python3-dev libyaml-dev libxml2-dev curl git make unzip g++ && \
  34. apt-get remove -y *-doc *-man && \
  35. rm -rf /usr/share/doc /usr/share/man && \
  36. apt-get autoremove -y && \
  37. rm -rf /var/lib/apt/lists/* && \
  38. apt-get clean
  39. EXPOSE 8000
  40. ENV BROWSER /browser
  41. ENV LC_ALL en_US.UTF-8
  42. ENV COUPLES_SERVER_TIME 7200