-
Notifications
You must be signed in to change notification settings - Fork 27
/
Dockerfile-mpc
64 lines (50 loc) · 1.68 KB
/
Dockerfile-mpc
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
FROM ghcr.io/clearmatics/zeth:0.0.2-base AS stage1
LABEL org.opencontainers.image.source https://github.com/clearmatics/zeth
# 1. Build phase 1: powers of tau rust binaries
ENV POT_PATH=/home/powersoftau
RUN apk --update --no-cache add \
musl-dev \
rust \
cargo
RUN git clone https://github.com/clearmatics/powersoftau ${POT_PATH}
RUN cd ${POT_PATH} \
&& git submodule update --init --recursive \
&& cargo install --path . \
&& mv /root/.cargo/bin/* /usr/local/bin
# 2. Build phase 2: phase 2 c++ binaries
ENV ZETH_PATH=/home/zeth
COPY . ${ZETH_PATH}
RUN cd ${ZETH_PATH} \
&& git submodule update --init --recursive
RUN cd ${ZETH_PATH} && mkdir build && cd build \
&& cmake -DSTATIC_BUILD=ON .. \
&& make -j"$(($(nproc)+1))" mpc-client-phase2 \
&& mv ${ZETH_PATH}/build/mpc_tools/mpc_phase2/mpc-client-phase2 /usr/local/bin
##
FROM alpine:3.12
LABEL org.opencontainers.image.source https://github.com/clearmatics/zeth
# Move rust and c++ binaries from previous image and put it in the PATH
COPY --from=stage1 /usr/local/bin/ /usr/local/bin
# Move the mpc python code
COPY --from=stage1 /home/zeth/mpc/ /home/zeth-mpc
COPY --from=stage1 /home/zeth/scripts/docker/entrypoint-mpc /home/zeth-mpc/entrypoint
RUN apk --update --no-cache add \
bash \
# Install necessary shared libs to run the rust binaries
gcc \
# Necessary packages to use the MPC python code
build-base \
linux-headers \
python3-dev \
make
RUN cd /home/zeth-mpc \
&& python3 -m venv env \
&& source env/bin/activate \
&& make setup
RUN apk del \
linux-headers \
build-base \
make
WORKDIR /home/zeth-mpc
ENTRYPOINT ["./entrypoint"]
CMD ["/bin/bash"]