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 160
/
Dockerfile.ALPINE.HElib
86 lines (68 loc) · 2.7 KB
/
Dockerfile.ALPINE.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
ARG PlatformRelease
FROM $PlatformRelease
ENV container docker
LABEL maintainer="Gregory Boland <boland@us.ibm.com>"
ARG USER_ID
# Docker Container for Alpine HElib Base
USER root
# Update the base OS
RUN apk update && apk upgrade
# Install the compilation toolchain and additional packages we need..
RUN apk add --no-cache autoconf bash xz curl wget tar git gcc g++ cmake make diffutils file patchelf vim
RUN apk add coreutils ncurses
RUN curl -#L https://github.com/bats-core/bats-core/archive/master.zip | unzip -
RUN bash bats-core-master/install.sh /usr/local
RUN rm -rf ./bats-core-master
# Install Doxygen so we can build the docs inside the container
RUN apk add --no-cache doxygen
# Install GMP dependency
RUN apk add --no-cache gmp-dev
# Install IBM Fully Homomorphic Encryption Library for ML Dependency
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community hdf5-dev
# 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} --disabled-password fhe
WORKDIR /home/fhe
RUN mkdir -p /home/fhe/FHE_Examples
RUN cp -pr /opt/IBM/FHE-distro/HElib/examples /home/fhe/FHE_Examples
RUN chown -R fhe:fhe /opt/IBM
CMD ["bash"]