Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/OpenNMT/OpenNMT.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Klein <guillaumekln@users.noreply.github.com>2018-02-27 12:24:26 +0300
committerGitHub <noreply@github.com>2018-02-27 12:24:26 +0300
commit911b802ba1b81d7e20a8b464f18b99096ab8ee7e (patch)
tree3b1e33a2cbec3d676a3fed8d80416917107e1adb
parent364000444b19814ebe30bfa06b6438e7f76c8efc (diff)
parent817ebe60a8720ecb57ad877b87c9cb1327dfab24 (diff)
Merge pull request #519 from guillaumekln/docker-update
Reduce the Docker image size
-rw-r--r--.dockerignore1
-rw-r--r--.travis.yml9
-rw-r--r--CHANGELOG.md1
-rw-r--r--Dockerfile124
-rw-r--r--docs/installation.md7
5 files changed, 91 insertions, 51 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..72e8ffc0
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1 @@
+*
diff --git a/.travis.yml b/.travis.yml
index b1aeb2ec..c6acd41b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,10 +1,9 @@
-sudo: required
+sudo: required
language: c
services:
- docker
before_install:
- sudo docker pull opennmt/opennmt:latest
- - sudo docker build -t opennmt/opennmt:latest --cache-from opennmt/opennmt:latest .
- sudo docker run -itd --name build -v $(pwd):/repo -w /repo opennmt/opennmt:latest
before_script:
- export LUA=$(docker exec build which luajit lua | head -n 1)
@@ -15,9 +14,3 @@ script:
- sudo docker exec build luacov
after_success:
- bash <(curl -s https://codecov.io/bash)
- - |
- if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- sudo docker tag opennmt/opennmt:latest opennmt/opennmt:$TRAVIS_BUILD_NUMBER
- docker push opennmt/opennmt
- fi
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ae55ed43..7ae26476 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,7 @@
* Fix retraining from a language model
* Fix `-update_vocab` option for language models
* Correct error handling for all file open commands
+* Reduce the Docker image size
## [v0.9.7](https://github.com/OpenNMT/OpenNMT/releases/tag/v0.9.7) (2017-12-19)
diff --git a/Dockerfile b/Dockerfile
index feebea04..096ed302 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,39 +1,91 @@
-# Start with CUDA Torch dependencies 2
-FROM kaixhin/cuda-torch:8.0
+FROM nvidia/cuda:8.0-devel-ubuntu16.04 as torch_builder
+
+RUN apt-get update && \
+ apt-get install -y \
+ autoconf \
+ automake \
+ build-essential \
+ cmake \
+ curl \
+ g++ \
+ gcc \
+ git \
+ libprotobuf-dev \
+ libprotobuf9v5 \
+ libreadline-dev \
+ libtool \
+ libzmq-dev \
+ pkg-config \
+ protobuf-compiler \
+ unzip
+
+# Compile Torch and OpenNMT dependencies.
+ARG CUDA_ARCH
+ENV CUDA_ARCH=${CUDA_ARCH:-Common}
+RUN git clone https://github.com/torch/distro.git /root/torch-distro --recursive && \
+ cd /root/torch-distro && \
+ mkdir /root/torch && \
+ TORCH_CUDA_ARCH_LIST=${CUDA_ARCH} TORCH_NVCC_FLAGS="-Xfatbin -compress-all" \
+ PREFIX=/root/torch ./install.sh
+RUN /root/torch/bin/luarocks install tds && \
+ /root/torch/bin/luarocks install dkjson && \
+ /root/torch/bin/luarocks install wsapi && \
+ /root/torch/bin/luarocks install yaml && \
+ /root/torch/bin/luarocks install bit32 && \
+ /root/torch/bin/luarocks install luacheck && \
+ /root/torch/bin/luarocks install luacov && \
+ /root/torch/bin/luarocks install lua-zmq \
+ ZEROMQ_LIBDIR=/usr/lib/x86_64-linux-gnu/ ZEROMQ_INCDIR=/usr/include
+
+# Install lua-sentencepiece
+RUN git clone https://github.com/google/sentencepiece.git /root/sentencepiece-git && \
+ cd /root/sentencepiece-git && \
+ ./autogen.sh && \
+ ./configure --prefix=/root/sentencepiece && \
+ make && \
+ make install && \
+ cd /root && \
+ rm -r /root/sentencepiece-git
+RUN git clone https://github.com/OpenNMT/lua-sentencepiece.git /root/lua-sentencepiece && \
+ cd /root/lua-sentencepiece && \
+ CMAKE_LIBRARY_PATH=/root/sentencepiece/lib CMAKE_INCLUDE_PATH=/root/sentencepiece/include \
+ /root/torch/bin/luarocks make lua-sentencepiece-scm-1.rockspec \
+ LIBSENTENCEPIECE_DIR=/root/sentencepiece && \
+ cd /root && \
+ rm -r /root/lua-sentencepiece
+
+# Fetch OpenNMT.
+ARG ONMT_URL
+ENV ONMT_URL=${ONMT_URL:-https://github.com/OpenNMT/OpenNMT.git}
+ARG ONMT_REF
+ENV ONMT_REF=${ONMT_REF:-master}
+RUN git clone --depth 1 --branch ${ONMT_REF} --single-branch ${ONMT_URL} /root/opennmt
+
+
+FROM nvidia/cuda:8.0-runtime-ubuntu16.04
MAINTAINER OpenNMT <http://opennmt.net/>
-# Needed libs for luarocks--audio and zmq server
-RUN sudo apt-get install -y libzmq-dev libfftw3-dev libsox-dev
-
-# Needed for test
-RUN luarocks install luacheck && \
- luarocks install luacov
-
-RUN luarocks install tds && \
- luarocks install dkjson && \
- luarocks install lua-zmq ZEROMQ_LIBDIR=/usr/lib/x86_64-linux-gnu/ ZEROMQ_INCDIR=/usr/include && \
- luarocks install sundown && \
- luarocks install cwrap && \
- luarocks install paths && \
- luarocks install torch && \
- luarocks install nn && \
- luarocks install dok && \
- luarocks install gnuplot && \
- luarocks install qtlua && \
- luarocks install qttorch && \
- luarocks install luafilesystem && \
- luarocks install penlight && \
- luarocks install sys && \
- luarocks install xlua && \
- luarocks install image && \
- luarocks install optim && \
- luarocks install lua-cjson && \
- luarocks install trepl && \
- luarocks install nnx && \
- luarocks install threads && \
- luarocks install graphicsmagick && \
- luarocks install argcheck && \
- luarocks install audio && \
- luarocks install signal && \
- luarocks install bit32
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends \
+ libgomp1 \
+ libprotobuf9v5 \
+ libzmq1 \
+ python3 && \
+ apt-get clean && \
+ rm -rf /var/lib/apt/lists/*
+
+ENV TORCH_DIR=/root/torch
+ENV SENTENCEPIECE_DIR=/root/sentencepiece
+ENV ONMT_DIR=/root/opennmt
+
+COPY --from=torch_builder /root/torch ${TORCH_DIR}
+COPY --from=torch_builder /root/sentencepiece ${SENTENCEPIECE_DIR}
+COPY --from=torch_builder /root/opennmt ${ONMT_DIR}
+
+ENV LUA_PATH="${TORCH_DIR}/share/lua/5.1/?.lua;${TORCH_DIR}/share/lua/5.1/?/init.lua;./?.lua"
+ENV LUA_CPATH="${TORCH_DIR}/lib/lua/5.1/?.so;./?.so;${TORCH_DIR}/lib/?.so"
+ENV PATH=${TORCH_DIR}/bin:${PATH}
+ENV LD_LIBRARY_PATH=${TORCH_DIR}/lib:${LD_LIBRARY_PATH}
+ENV THC_CACHING_ALLOCATOR=0
+WORKDIR $ONMT_DIR
diff --git a/docs/installation.md b/docs/installation.md
index 84502b85..43498a9c 100644
--- a/docs/installation.md
+++ b/docs/installation.md
@@ -28,13 +28,6 @@ And you are ready to go! Take a look at the [quickstart](quickstart.md) to famil
sudo nvidia-docker run -it opennmt/opennmt:latest
```
-3\. Clone the OpenNMT repository:
-
-```bash
-git clone https://github.com/OpenNMT/OpenNMT ~/OpenNMT
-cd ~/OpenNMT
-```
-
## Amazon EC2
The best way to do this is through Docker. We have a public AMI with the preliminary CUDA drivers installed: `ami-c12f86a1`. Start a P2/G2 GPU instance with this AMI and run the `nvidia-docker` command above to get started.