This repository has been archived by the owner on Aug 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 159
/
Copy pathDockerfile.CENTOS.HElib
99 lines (80 loc) · 3.02 KB
/
Dockerfile.CENTOS.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
ARG PlatformRelease
FROM $PlatformRelease
ENV container docker
LABEL maintainer="Flavio Bergamaschi <[email protected]>"
ARG USER_ID
# Docker Container for CentOS HElib Base
USER root
# Update the base OS
RUN yum -y update
RUN yum clean packages
# Setup the toolchain
RUN yum -y install epel-release
RUN yum repolist
RUN yum -y install autoconf xz curl wget tar git gcc gcc-c++ make diffutils file patchelf vim python3 python2 openssl-devel
RUN yum clean packages
# Install GMP dependency
RUN yum -y install gmp-devel
RUN yum clean packages
# Install IBM Fully Homomorphic Encryption Library for ML Dependency
RUN yum -y install curl boost-devel
# These commands are needed for HDF5 which the Encryption ML Demo relies on...
RUN dnf install -y 'dnf-command(config-manager)'
RUN dnf config-manager -y --set-enabled powertools
RUN dnf install -y hdf5-devel
RUN yum clean packages
RUN git clone https://github.com/bats-core/bats-core.git && \
cd bats-core && \
./install.sh /usr/local
RUN wget https://github.com/Kitware/CMake/releases/download/v3.17.3/cmake-3.17.3.tar.gz && \
tar -zxvf cmake-3.17.3.tar.gz && \
cd cmake-3.17.3 && \
./bootstrap && \
make && \
make install
# Create dependencies build environment and copy NTL and HElib distros into it.
RUN mkdir -p /opt/IBM/FHE-distro
# 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
# Copy over the toolkit original examples into the HElib distribution inside the container
COPY ./samples/ /opt/IBM/FHE-distro/HElib/examples/
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
# 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
# download, 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
# Create user fhe:fhe with no login,
RUN adduser --uid ${USER_ID} --comment "FHE Toolkit User" fhe
RUN usermod -L 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"]