forked from IBM/fhe-toolkit-linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.UBUNTU.HElib
117 lines (93 loc) · 3.4 KB
/
Dockerfile.UBUNTU.HElib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
ARG PlatformRelease
FROM $PlatformRelease
ENV container docker
LABEL maintainer="Flavio Bergamaschi <[email protected]>"
ARG USER_ID
# Docker Container for Ubuntu HElib Base
USER root
# Setup the toolchain
RUN apt update
# set noninteractive installation
RUN export DEBIAN_FRONTEND=noninteractive
# Update the base OS
RUN DEBIAN_FRONTEND=noninteractive apt update
RUN DEBIAN_FRONTEND=noninteractive apt dist-upgrade -y
# Install Doxygen so we can build the docs inside the container
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
doxygen
# Install tzdata package
RUN DEBIAN_FRONTEND=noninteractive apt install -y tzdata
# Set UTC timezone
RUN ln -fs /usr/share/zoneinfo/UTC /etc/localtime
RUN dpkg-reconfigure --frontend noninteractive tzdata
# Install the compilation toolchain we need...
RUN DEBIAN_FRONTEND=noninteractive apt install -y \
xz-utils \
curl \
wget \
build-essential \
git \
cmake \
m4 \
file \
patchelf \
vim
# Install bats-core
RUN git clone https://github.com/bats-core/bats-core.git && \
cd bats-core && \
./install.sh /usr/local
# Install GMP dependency for NTL
RUN DEBIAN_FRONTEND=noninteractive apt install -y libgmp-dev
# Install HDF5 dependency for FHE ML library
RUN DEBIAN_FRONTEND=noninteractive apt install -y libhdf5-dev libhdf5-103
# Cleanup unnecessary and downloaded packages (.deb) during installation
RUN DEBIAN_FRONTEND=noninteractive apt autoremove -y
RUN DEBIAN_FRONTEND=noninteractive apt autoclean -y
# Create dependencies build environment.
RUN mkdir -p /opt/IBM/FHE-distro
# Download, build and install NTL as system library in /usr/local
COPY ./DEPENDENCIES/NTL /opt/IBM/FHE-distro/NTL
WORKDIR /opt/IBM/FHE-distro/NTL
RUN cd ./src && \
./configure SHARED=on NTL_GMP_LIP=on NTL_THREADS=on NTL_THREAD_BOOST=on NTL_RANDOM_AES256CTR=on && \
make -j4 && \
make install && \
ldconfig && \
cd ../.. && \
rm -rf NTL
# Download, build and install HElib as system library in /usr/local
COPY ./DEPENDENCIES/HElib /opt/IBM/FHE-distro/HElib
WORKDIR /opt/IBM/FHE-distro/HElib
RUN mkdir ./build && \
cd ./build && \
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED=ON -DENABLE_THREADS=ON .. && \
make -j4 && \
make install && \
ldconfig
#Generate the docs of HElib from their source
WORKDIR /opt/IBM/FHE-distro/HElib/documentation
RUN doxygen Doxyfile
# Download, build and install Boost as system library in /usr/local
COPY ./DEPENDENCIES/boost /opt/IBM/FHE-distro/boost
WORKDIR /opt/IBM/FHE-distro/boost
RUN ./bootstrap.sh --with-libraries=filesystem,system,thread && \
./b2 -d0 -j4 install && \
ldconfig && \
cd .. && \
rm -rf boost
# Build and install ML-HElib as system library in /usr/local
COPY ./DEPENDENCIES/ML-HElib /opt/IBM/FHE-distro/ML-HElib
WORKDIR /opt/IBM/FHE-distro/ML-HElib
RUN /bin/bash ./install_system_wide.sh && \
ldconfig
#Generate the docs of ML-HElib from their source
WORKDIR /opt/IBM/FHE-distro/ML-HElib/documentation
RUN doxygen Doxyfile
# Create user fhe:fhe with no login,
RUN adduser --uid ${USER_ID} --gecos "FHE Toolkit User" --disabled-login fhe
WORKDIR /home/fhe
USER fhe
RUN mkdir -p /home/fhe/FHE_Examples
RUN cp -pr /opt/IBM/FHE-distro/HElib/examples/. /home/fhe/FHE_Examples
CMD ["/usr/bin/bash"]