-
Notifications
You must be signed in to change notification settings - Fork 62
/
Dockerfile.node
96 lines (85 loc) · 3.39 KB
/
Dockerfile.node
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
FROM debian:stable-slim AS build
# Install build dependencies
RUN apt-get update -y \
&& apt-get install automake build-essential pkg-config libffi-dev libgmp-dev libssl-dev libtinfo-dev libsystemd-dev zlib1g-dev make g++ tmux git jq wget libncursesw5 libtool autoconf liblmdb-dev -y \
&& apt-get install -y libsqlite3-dev m4 ca-certificates gcc libc6-dev curl \
&& apt-get clean
# Install GHC
ENV CABAL_VERSION=3.8.1.0 \
GHC_VERSION=8.10.7 \
PATH="$HOME/.cabal/bin:/root/.ghcup/bin:$PATH"
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh \
&& ghcup install ghc ${GHC_VERSION} \
&& ghcup install cabal ${CABAL_VERSION} \
&& ghcup set ghc ${GHC_VERSION} \
&& ghcup set cabal ${CABAL_VERSION}
# Install libsodium
ARG LIBSODIUM_VERSION
RUN git clone https://github.com/IntersectMBO/libsodium \
&& cd libsodium \
&& git fetch --all --recurse-submodules --tags \
&& git tag \
&& git checkout $LIBSODIUM_VERSION \
&& ./autogen.sh \
&& ./configure \
&& make \
&& make install \
&& cd .. && rm -rf libsodium
ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" \
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
# Install Secp256k1
RUN git clone https://github.com/bitcoin-core/secp256k1 \
&& cd secp256k1 \
&& git checkout ac83be33 \
&& ./autogen.sh \
&& ./configure --enable-module-schnorrsig --enable-experimental \
&& make && make install
# Install blst
COPY <<"EOT" /usr/local/lib/pkgconfig/libblst.pc
prefix=/usr/local
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
includedir=\${prefix}/include
Name: libblst
Description: Multilingual BLS12-381 signature library
URL: https://github.com/supranational/blst
Version: 0.3.10
Cflags: -I\${includedir}
Libs: -L\${libdir} -lblst
EOT
RUN git clone https://github.com/supranational/blst \
&& cd blst \
&& git checkout v0.3.10 \
&& ./build.sh \
&& cp bindings/blst_aux.h bindings/blst.h bindings/blst.hpp /usr/local/include/ \
&& cp libblst.a /usr/local/lib \
&& chmod u=rw,go=r /usr/local/lib/libblst.a \
&& chmod u=rw,go=r /usr/local/lib/pkgconfig/libblst.pc \
&& chmod u=rw,go=r /usr/local/include/blst.h \
&& chmod u=rw,go=r /usr/local/include/blst.hpp \
&& chmod u=rw,go=r /usr/local/include/blst_aux.h
# Install cardano-node
ARG VERSION
RUN echo "Building tags/${VERSION}..." \
&& echo tags/${VERSION} > /CARDANO_BRANCH \
&& git clone https://github.com/IntersectMBO/cardano-node \
&& cd cardano-node \
&& git fetch --all --recurse-submodules --tags \
&& git tag \
&& git checkout tags/${VERSION} \
&& echo "with-compiler: ghc-${GHC_VERSION}" >> cabal.project.local \
&& echo "package cardano-crypto-praos" >> cabal.project.local \
&& echo " flags: -external-libsodium-vrf" >> cabal.project.local \
&& cabal update \
&& cabal build all \
&& cabal build cardano-cli \
&& mkdir -p /root/.local/bin/ \
&& cp -p "$(./scripts/bin-path.sh cardano-node)" /root/.local/bin/ \
&& cp -p "$(./scripts/bin-path.sh cardano-cli)" /root/.local/bin/ \
&& cd .. && rm -rf cardano-node
# Run
FROM debian:stable-slim
COPY --from=build /root/.local/bin/ /bin/
COPY --from=build /usr/local/lib/ /lib/
SHELL ["/bin/bash", "-c"]
ENTRYPOINT ["cardano-node"]