Skip to content

Commit ad9f3c0

Browse files
Enrico Steffinlongohamishun
Enrico Steffinlongo
authored andcommitted
Added Ubuntu 18.04 based dockerfile (#156)
* Changed to ubuntu18.04 * Updated dockerfile to lib build * Added some usage docs * Added dockerignore
1 parent f080b26 commit ad9f3c0

File tree

3 files changed

+37
-20
lines changed

3 files changed

+37
-20
lines changed

.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
# A local cmake cache will affect the docker image build
22
CMakeCache.txt
3+
# Typical build directory name - if copied in from the host, the image will
4+
# be very bloated and could interfere with the build process
5+
build

DOCKER_USAGE.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Dockerized usage
2+
To create an Ubuntu 18.04-based docker image with HElib and its dependencies
3+
installed, use the following steps:
4+
5+
1. Clone HElib and `cd` into it.
6+
2. Run `docker build .`, optionally tagging with `-t helib` or similar. This
7+
will create an image with HElib installed globally in `/usr/local`. Most
8+
build systems and compilers will look in here. Furthermore, `cmake` can be
9+
used with `find_package(helib)` and invoked with no special command-line
10+
arguments.
11+
3. The image is now ready to be used. Some possibilities include:
12+
- Create a Dockerfile which begins with `FROM helib`, where `helib` may be
13+
any tag you used in step 2, and include your application logic in this
14+
Dockerfile.
15+
- Run a container from the HElib docker image directly to experiment, with
16+
`docker run -it helib bash`

Dockerfile

+18-20
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
1-
FROM alpine:3.8
1+
FROM ubuntu:18.04
22

3-
# Location of the src in the contrainer
4-
ARG helibDir=/helib
5-
# Location of the build in the contrainer
6-
ARG buildDir=/build
3+
COPY ./ /root/HElib/
74

8-
COPY . ${helibDir}
9-
10-
# Currently fails when cmake is invoked
11-
RUN apk add --update \
12-
g++ \
13-
make \
14-
cmake \
15-
libtool \
16-
&& rm -rf /var/cache/apk/* \
17-
&& mkdir ${buildDir} \
18-
&& cd ${buildDir} \
19-
&& cmake ${helibDir} \
20-
&& make
21-
22-
CMD [ "" ]
5+
RUN apt update && \
6+
apt install -y build-essential wget cmake m4 libgmp-dev file && \
7+
cd ~ && \
8+
wget https://www.shoup.net/ntl/ntl-11.3.2.tar.gz && \
9+
tar xf ntl-11.3.2.tar.gz && \
10+
cd ntl-11.3.2/src && \
11+
./configure SHARED=on NTL_GMP_LIP=on NTL_THREADS=on NTL_THREAD_BOOST=on && \
12+
make -j4 && \
13+
make install && \
14+
cd ~ && \
15+
mkdir HElib/build && \
16+
cd HElib/build && \
17+
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED=ON -DENABLE_THREADS=ON .. && \
18+
make -j4 && \
19+
make install && \
20+
ldconfig
2321

0 commit comments

Comments
 (0)