From 8eefb3db6bb128deb34d83cf1516d3b28d3497e1 Mon Sep 17 00:00:00 2001 From: Oliver Mannion <125105+tekumara@users.noreply.github.com> Date: Mon, 20 May 2019 16:51:56 +1000 Subject: [PATCH] add Dockerfile for building SPTAG (#36) * add Dockerfile for building * add trailing slash in README.md * add SPTAG to PYTHONPATH * update cmake comment to be more specific --- Dockerfile | 31 +++++++++++++++++++++++++++++++ README.md | 6 ++++++ 2 files changed, 37 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..e7cedb33 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +FROM ubuntu:18.04 + +WORKDIR /app +COPY CMakeLists.txt ./ +COPY AnnService ./AnnService/ +COPY Test ./Test/ +COPY Wrappers ./Wrappers/ + +RUN apt-get update && apt-get -y install wget build-essential libtbb-dev \ + # remove the following if you don't want to build the wrappers + openjdk-8-jdk python3-pip swig + +# cmake >= 3.12 is required +RUN wget "https://github.com/Kitware/CMake/releases/download/v3.14.4/cmake-3.14.4-Linux-x86_64.tar.gz" -q -O - \ + | tar -xz --strip-components=1 -C /usr/local + +# specific version of boost +RUN wget "https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz" -q -O - \ + | tar -xz && \ + cd boost_1_67_0 && \ + ./bootstrap.sh && \ + ./b2 install && \ + # update ld cache so it finds boost in /usr/local/lib + ldconfig && \ + cd .. && rm -rf boost_1_67_0 + +# build +RUN mkdir build && cd build && cmake .. && make && cd .. + +# so python can find the SPTAG module +ENV PYTHONPATH=/app/Release \ No newline at end of file diff --git a/README.md b/README.md index 684ed384..20f2a545 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,12 @@ cd build && cmake -A x64 .. It will generate a SPTAGLib.sln in the build directory. Compiling the ALL_BUILD project in the Visual Studio (at least 2015) will generate a Release directory which contains all the build targets. +> Using Docker: +```bash +docker build -t sptag . +``` +Will build a docker container with binaries in `/app/Release/` + ### **Verify** Run the test (or Test.exe) in the Release folder to verify all the tests have passed.