forked from abracadaniel/cardano-pool-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
137 lines (122 loc) · 5.19 KB
/
Dockerfile
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
from debian:stable-slim
LABEL maintainer="dro@arrakis.it"
SHELL ["/bin/bash", "-c"]
# Install build dependencies
RUN apt-get update -y \
&& apt-get install -y 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 libsqlite3-dev m4 ca-certificates gcc libc6-dev \
&& apt-get clean
# Install rust
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.47.0
RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='49c96f3f74be82f4752b8bffcf81961dea5e6e94ce1ccba94435f12e871c3bdb' ;; \
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='5a2be2919319e8778698fa9998002d1ec720efe7cb4f6ee4affb006b5e73f1be' ;; \
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='d93ef6f91dab8299f46eef26a56c2d97c66271cea60bf004f2f088a86a697078' ;; \
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e3d0ae3cfce5c6941f74fed61ca83e53d4cd2deb431b906cbd0687f246efede4' ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
url="https://static.rust-lang.org/rustup/archive/1.22.1/${rustArch}/rustup-init"; \
wget "$url"; \
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
chmod +x rustup-init; \
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version; \
rm -rf /var/lib/apt/lists/*;
# Install cabal
ENV PATH="/root/.cabal/bin:/root/.ghcup/bin:/root/.local/bin:$PATH"
RUN wget https://downloads.haskell.org/~cabal/cabal-install-3.2.0.0/cabal-install-3.2.0.0-x86_64-unknown-linux.tar.xz \
&& tar -xf cabal-install-3.2.0.0-x86_64-unknown-linux.tar.xz \
&& rm cabal-install-3.2.0.0-x86_64-unknown-linux.tar.xz cabal.sig \
&& mkdir -p ~/.local/bin \
&& mv cabal ~/.local/bin/ \
&& cabal update && cabal --version
# Install GHC
RUN wget https://downloads.haskell.org/ghc/8.10.2/ghc-8.10.2-x86_64-deb9-linux.tar.xz \
&& tar -xf ghc-8.10.2-x86_64-deb9-linux.tar.xz \
&& rm ghc-8.10.2-x86_64-deb9-linux.tar.xz \
&& cd ghc-8.10.2 \
&& ./configure \
&& make install \
&& cd / \
&& rm -rf /ghc-8.10.2
# Install libsodium
RUN git clone https://github.com/input-output-hk/libsodium \
&& cd libsodium \
&& git checkout 66f017f1 \
&& ./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 cardano-node
ARG VERSION
RUN echo "Building tags/$VERSION..." \
&& echo tags/$VERSION > /CARDANO_BRANCH \
&& git clone https://github.com/input-output-hk/cardano-node.git \
&& cd cardano-node \
&& git fetch --all --recurse-submodules --tags \
&& git tag \
&& git checkout tags/$VERSION \
&& cabal configure --with-compiler=ghc-8.10.2 \
&& echo "package cardano-crypto-praos" >> cabal.project.local \
&& echo " flags: -external-libsodium-vrf" >> cabal.project.local \
&& cabal build all \
&& mkdir -p /root/.local/bin/ \
&& cp -p dist-newstyle/build/x86_64-linux/ghc-8.10.2/cardano-node-${VERSION}/x/cardano-node/build/cardano-node/cardano-node /root/.local/bin/ \
&& cp -p dist-newstyle/build/x86_64-linux/ghc-8.10.2/cardano-cli-${VERSION}/x/cardano-cli/build/cardano-cli/cardano-cli /root/.local/bin/ \
&& rm -rf /root/.cabal/packages \
&& rm -rf /usr/local/lib/ghc-8.6.5/ \
&& rm -rf /cardano-node/dist-newstyle/ \
&& rm -rf /root/.cabal/store/ghc-8.6.5
# Install cncli
RUN git clone https://github.com/AndrewWestberg/cncli \
&& cd cncli \
&& cargo install --path . --force \
&& cncli -V
# Install tools
RUN apt-get update -y \
&& apt-get install -y vim procps dnsutils bc curl nano cron python3 python3-pip \
&& apt-get clean
RUN pip3 install pytz
# Expose ports
## cardano-node, EKG, Prometheus
EXPOSE 3000 12788 12798
# ENV variables
ENV NODE_PORT="3000" \
NODE_NAME="node1" \
NODE_TOPOLOGY="" \
NODE_RELAY="False" \
CARDANO_NETWORK="main" \
EKG_PORT="12788" \
PROMETHEUS_PORT="12798" \
RESOLVE_HOSTNAMES="False" \
REPLACE_EXISTING_CONFIG="False" \
POOL_PLEDGE="100000000000" \
POOL_COST="10000000000" \
POOL_MARGIN="0.05" \
METADATA_URL="" \
PUBLIC_RELAY_IP="TOPOLOGY" \
WAIT_FOR_SYNC="True" \
AUTO_TOPOLOGY="True" \
PATH="/root/.local/bin/:/scripts/:/scripts/functions/:/cardano-node/scripts/:${PATH}" \
LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}" \
CARDANO_NODE_SOCKET_PATH="DEFAULT" \
LANG="C.UTF-8"
# Add config
ADD cfg-templates/ /cfg-templates/
RUN mkdir -p /config/
VOLUME /config/
# Add scripts
ADD scripts/ /scripts/
RUN chmod -R +x /scripts/
ENTRYPOINT ["/scripts/start-cardano-node"]