-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
100 lines (80 loc) · 2.59 KB
/
Dockerfile
File metadata and controls
100 lines (80 loc) · 2.59 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
FROM ubuntu:20.04 as builder
ARG CABAL_VERSION=3.4.0.0
ARG GHC_VERSION=8.10.4
ARG CARDANO_VERSION
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
wget \
curl \
haskell-platform \
build-essential \
pkg-config \
libffi-dev \
libgmp-dev \
libssl-dev \
libtinfo-dev \
libsystemd-dev \
zlib1g-dev \
make \
g++ \
git \
jq \
libncursesw5 \
llvm-9 \
libnuma-dev \
libtool \
upx
ENV PATH="/root/.cabal/bin:/root/.local/bin:${PATH}"
WORKDIR /src
# install libsodium
RUN git clone https://github.com/input-output-hk/libsodium && \
cd libsodium && \
git checkout 66f017f1 && \
./autogen.sh && \
./configure && \
make && \
make install
ENV LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}" \
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}"
# download cabal
RUN wget http://hackage.haskell.org/package/cabal-install-${CABAL_VERSION}/cabal-install-${CABAL_VERSION}.tar.gz \
&& tar -xf cabal-install-${CABAL_VERSION}.tar.gz \
&& cd cabal-install-${CABAL_VERSION} \
&& cabal update \
&& cabal install \
&& cabal --version
RUN wget -q http://downloads.haskell.org/~ghc/${GHC_VERSION}/ghc-${GHC_VERSION}-aarch64-deb10-linux.tar.xz \
&& tar -xf ghc-${GHC_VERSION}-aarch64-deb10-linux.tar.xz \
&& cd ghc-${GHC_VERSION} \
&& ./configure \
&& make install
# fetch and configure cardano-node
RUN git clone https://github.com/input-output-hk/cardano-node.git \
&& cd cardano-node \
&& git fetch --all --recurse-submodules --tags \
&& git checkout ${CARDANO_VERSION} \
&& cabal configure --with-compiler=ghc-${GHC_VERSION} \
&& echo -e "package cardano-crypto-praos\n flags: -external-libsodium-vrf" > cabal.project.local
# build/install cardano
WORKDIR /src/cardano-node
RUN mkdir -p ~/.local/bin \
&& cabal install -j --installdir ~/.local/bin cardano-cli cardano-node
# compress binaries
RUN upx --best -o ~/cardano-node $(readlink -f ~/.local/bin/cardano-node)
RUN upx --best -o ~/cardano-cli $(readlink -f ~/.local/bin/cardano-cli)
RUN cardano-cli --version
CMD ["/bin/bash"]
# build minimal image
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y \
netbase \
jq \
curl \
libnuma1
COPY --from=builder /usr/local/lib/libsodium.so.23 /lib/aarch64-linux-gnu/libsodium.so.23
COPY --from=builder /root/cardano-node /usr/local/bin/cardano-node
COPY --from=builder /root/cardano-cli /usr/local/bin/cardano-cli
USER 1001
EXPOSE 3001
ENV CARDANO_NODE_SOCKET_PATH=/ipc/socket
ENTRYPOINT ["/usr/local/bin/cardano-node"]