Last active
December 9, 2022 11:12
-
-
Save mberrueta/e10a47d6147998541720798193bf643f to your computer and use it in GitHub Desktop.
cardano-node Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian | |
# # https://developers.cardano.org/docs/get-started/installing-cardano-node/ | |
# Installing Operating System dependencies | |
RUN apt-get update -y && apt-get upgrade -y | |
RUN apt-get install -y --no-install-recommends \ | |
autoconf \ | |
automake \ | |
build-essential \ | |
ca-certificates \ | |
curl \ | |
g++ \ | |
git \ | |
jq \ | |
libffi-dev \ | |
libffi7 \ | |
libgmp-dev \ | |
libgmp10 \ | |
libncurses-dev \ | |
libncurses5 \ | |
libncursesw5 \ | |
libssl-dev \ | |
libsystemd-dev \ | |
libtinfo-dev \ | |
libtinfo5 \ | |
libtool \ | |
make \ | |
pkg-config \ | |
procps \ | |
tmux \ | |
vim \ | |
wget \ | |
zlib1g-dev \ | |
&& apt-get clean | |
# Installing ghcup | |
ENV BOOTSTRAP_HASKELL_NONINTERACTIVE=1 | |
RUN bash -c "curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh" | |
RUN bash -c "curl -sSL https://get.haskellstack.org/ | sh" | |
# Add ghcup to PATH | |
ENV PATH=${PATH}:/root/.local/bin | |
ENV PATH=${PATH}:/root/.ghcup/bin | |
RUN ghcup install ghc 8.10.7 | |
RUN ghcup set ghc 8.10.7 | |
RUN ghcup install cabal 3.6.2.0 | |
RUN ghcup set cabal 3.6.2.0 | |
# Get libsodium | |
RUN mkdir -p /root/cardano | |
WORKDIR /root/cardano | |
RUN git clone https://github.com/input-output-hk/libsodium.git | |
WORKDIR libsodium | |
RUN git checkout 66f017f1 | |
RUN ./autogen.sh | |
RUN ./configure | |
RUN make | |
RUN make install | |
# install Secp256k1 what is required for 1.35.0 cardano-node version | |
RUN export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" | |
RUN export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" | |
WORKDIR /root/cardano | |
RUN git clone https://github.com/bitcoin-core/secp256k1.git | |
WORKDIR secp256k1 | |
RUN git checkout ac83be33 | |
RUN ./autogen.sh | |
RUN ./configure --enable-module-schnorrsig --enable-experimental | |
RUN make | |
RUN make check | |
RUN make install | |
# Download and install cardano node | |
WORKDIR /root/cardano | |
RUN git clone https://github.com/input-output-hk/cardano-node.git | |
WORKDIR /root/cardano/cardano-node | |
RUN git fetch --all --recurse-submodules --tags | |
# RUN git checkout $(curl -s https://api.github.com/repos/input-output-hk/cardano-node/releases/latest | jq -r .tag_name) | |
RUN git checkout 1.35.3 | |
RUN cabal configure --with-compiler=ghc-8.10.7 | |
RUN apt install llvm-9 clang-9 libnuma-dev -y | |
RUN ln -s /usr/bin/llvm-config-9 /usr/bin/llvm-config | |
RUN ln -s /usr/bin/opt-9 /usr/bin/opt | |
RUN ln -s /usr/bin/llc-9 /usr/bin/llc | |
RUN ln -s /usr/bin/clang-9 /usr/bin/clang | |
RUN cabal build cardano-node cardano-cli | |
RUN mkdir -p /root/.local/bin | |
RUN cp -p "$(./scripts/bin-path.sh cardano-node)" /root/.local/bin/ | |
RUN cp -p "$(./scripts/bin-path.sh cardano-cli)" /root/.local/bin/ | |
RUN export PATH="/root/.local/bin/:$PATH" | |
RUN mkdir /root/tmp | |
WORKDIR /root/tmp | |
RUN curl -sS -o prereqs.sh https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/prereqs.sh | |
RUN chmod 755 prereqs.sh | |
ENV SUDO='N' | |
RUN ./prereqs.sh | |
RUN mkdir -p /root/data | |
RUN mkdir "/root/guild_tools" | |
WORKDIR "/root/guild_tools" | |
RUN curl -s -o gLiveView.sh https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/gLiveView.sh | |
RUN curl -s -o env https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/env | |
RUN chmod 755 gLiveView.sh | |
RUN echo 'CNODE_HOME=/root/cardano/cardano-node' >> ~/.bashrc | |
RUN echo 'DATA_HOME=/root/data' >> ~/.bashrc | |
RUN echo 'GUILD_HOME=/root/guild_tools' >> ~/.bashrc | |
RUN echo 'CARDANO_NODE_SOCKET_PATH=/root/data/node.socket' >> ~/.bashrc | |
# insert at line 8 | |
RUN sed -i '8i CNODE_PORT=3001' ~/guild_tools/env | |
RUN sed -i '8i CONFIG=$CNODE_HOME/configuration/cardano/mainnet-config.json' ~/guild_tools/env | |
RUN sed -i '8i SOCKET=$DATA_HOME/node.socket' ~/guild_tools/env | |
RUN sed -i '8i TOPOLOGY=$CNODE_HOME/configuration/cardano/mainnet-topology.json' ~/guild_tools/env | |
RUN sed -i '8i UPDATE_CHECK="N"' ~/guild_tools/env | |
RUN sed -i '8i CNODEBIN=${HOME}/.local/bin/cardano-node' ~/guild_tools/env | |
RUN sed -i '8i CCLI=${HOME}/.local/bin/cardano-cli' ~/guild_tools/env | |
WORKDIR /root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker build . --tag my_cardano | |
docker run -it my_cardano /bin/bash | |
cardano-node run \ | |
--socket-path $DATA_HOME/node.socket \ | |
--database-path $DATA_HOME/db \ | |
--port 3001 \ | |
--config $CNODE_HOME/configuration/cardano/mainnet-config.json \ | |
--topology $CNODE_HOME/configuration/cardano/mainnet-topology.json | |
# other term | |
container=$(docker ps | grep my_cardano | awk '{ print $1}') | |
docker exec -it $container /bin/bash | |
$GUILD_HOME/gLiveView.sh | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment