-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
145 lines (127 loc) · 4.08 KB
/
Copy pathDockerfile
File metadata and controls
145 lines (127 loc) · 4.08 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Classpoly Docker file
# -----------------------------------------------------------------------------
# Creates compilation image, i.e. you can modify the built sources.
# However, binaries are also compiled during image creation
# thus available in the image.
# Base image is an argument - debian or ubuntu.
ARG BASE_IMAGE=debian:latest
# Builder stage
# Multistage docker build, requires docker 17.05
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
# https://docs.docker.com/engine/reference/builder/
# https://medium.com/@tonistiigi/advanced-multi-stage-build-patterns-6f741b852fae
FROM ${BASE_IMAGE} AS base
RUN set -ex && \
apt-get update && \
apt-get --no-install-recommends --yes install \
autoconf \
automake \
bzip2 \
ca-certificates \
curl \
g++ \
git \
libgmp-dev \
libntl-dev \
libtool-bin \
make \
pkg-config \
python \
rsync \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/*
# Building class poly
FROM base AS builder
WORKDIR /usr/local
ENV PROJECT_DIR /usr/local/class-poly
ENV ZN_POLY zn_poly-0.9
ENV FF_POLY_BIG ff_poly_big_v1.2.7
ENV CLASSPOLY classpoly_v1.0.2
# Build either from current source or github repo (no local files needed then)
ARG DIR_BUSTER=0
ARG USE_GITHUB=0
# Building from GitHub is not supported now
RUN set -ex \
&& echo "DIR_BUSTER: $DIR_BUSTER" \
&& if [ "${USE_GITHUB}" = "1" ] ; then \
/bin/rm -rf ${PROJECT_DIR}-gh \
git clone https://github.com/ph4r05/class-poly ${PROJECT_DIR}-gh ; fi \
&& echo "Data copied"
# zn_poly
COPY src/$ZN_POLY/ $PROJECT_DIR/src/$ZN_POLY/
WORKDIR $PROJECT_DIR/src/$ZN_POLY
RUN set -ex \
&& ./configure \
&& make \
&& make install \
&& cp include/* /usr/local/include/zn_poly/
# ff_poly_big_v1.2.7
COPY src/$FF_POLY_BIG/ $PROJECT_DIR/src/$FF_POLY_BIG/
WORKDIR $PROJECT_DIR/src/$FF_POLY_BIG
RUN set -ex \
&& make \
&& make install \
&& cp *.h /usr/local/include/ff_poly/ \
&& cp ntutil.h /usr/local/include/
# classpoly_v1.0.2
COPY src/$CLASSPOLY/ $PROJECT_DIR/src/$CLASSPOLY/
WORKDIR $PROJECT_DIR/src/$CLASSPOLY
ARG CACHE_BUSTER=0
RUN set -ex \
&& echo ${CACHE_BUSTER} \
&& make \
&& mkdir $HOME/temp \
&& cp classpoly /usr/local/bin/
COPY src/fetch-jinv.sh /usr/local/bin/
RUN set -ex \
&& chmod +x /usr/local/bin/fetch-jinv.sh
WORKDIR /usr/local
########################################################################################################################
## OpenSSL
#ARG OPENSSL_VERSION=1.1.0j
#ARG OPENSSL_HASH=31bec6c203ce1a8e93d5994f4ed304c63ccf07676118b6634edded12ad1b3246
#RUN set -ex \
# && curl -s -O https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \
# && echo "${OPENSSL_HASH} openssl-${OPENSSL_VERSION}.tar.gz" | sha256sum -c \
# && tar -xzf openssl-${OPENSSL_VERSION}.tar.gz \
# && cd openssl-${OPENSSL_VERSION} \
# && ./Configure linux-x86_64 no-shared --static -fPIC \
# && make build_generated \
# && make libcrypto.a \
# && make install
#ENV OPENSSL_ROOT_DIR=/usr/local/openssl-${OPENSSL_VERSION}
#
## ZMQ
#ARG ZMQ_VERSION=v4.2.5
#ARG ZMQ_HASH=d062edd8c142384792955796329baf1e5a3377cd
#RUN set -ex \
# && git clone https://github.com/zeromq/libzmq.git -b ${ZMQ_VERSION} \
# && cd libzmq \
# && test `git rev-parse HEAD` = ${ZMQ_HASH} || exit 1 \
# && ./autogen.sh \
# && CFLAGS="-fPIC" CXXFLAGS="-fPIC" ./configure --enable-static --disable-shared \
# && make \
# && make install \
# && ldconfig
#WORKDIR /src
#COPY . .
#ARG NPROC
#RUN set -ex && \
# git submodule init && git submodule update && \
# rm -rf build && \
# if [ -z "$NPROC" ] ; \
# then make -j$(nproc) release-static ; \
# else make -j$NPROC release-static ; \
# fi
## runtime stage
#FROM ubuntu:16.04
#
#RUN set -ex && \
# apt-get update && \
# apt-get --no-install-recommends --yes install ca-certificates && \
# apt-get clean && \
# rm -rf /var/lib/apt
#COPY --from=builder /src/build/release/bin /usr/local/bin/
# Contains data
#VOLUME /root/.test