Categories
cardano Uncategorized

cardano node Dockerfile

cardano-node.yml

version: '3'
services:
  jenkins:
    image: koolwith/cardano-node
    user: root:root
    restart: always
    container_name: cardano-node1
    environment:
      TZ: "Asia/Kolkata"
    volumes:
      - /opt//cardano-my-node:/root/cardano-my-node
    ports:
      - 6000:6000

cardano-node.Dockerfile

docker build -t cardano-node -f cardano-node.Dockerfile .
FROM debian:stable-slim as base
RUN apt-get update -y
RUN apt-get install git jq bc make rsync htop curl build-essential pkg-config libffi-dev libgmp-dev libssl-dev libtinfo-dev libsystemd-dev zlib1g-dev make g++ wget libncursesw5 libtool autoconf -y

RUN mkdir $HOME/git \
    && cd $HOME/git \
    && git clone https://github.com/input-output-hk/libsodium \
    && cd libsodium \
    && git checkout 66f017f1 \
    && ./autogen.sh \
    && ./configure \
    && make \
    && make install

RUN cd \
    && 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 $HOME/.local/bin \
    && mv cabal $HOME/.local/bin/

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

RUN echo PATH="$HOME/.local/bin:$PATH" >> $HOME/.bashrc \
    &&  echo export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" >> $HOME/.bashrc \
    &&  echo export NODE_HOME=$HOME/cardano-my-node >> $HOME/.bashrc \
    &&  echo export NODE_CONFIG=mainnet>> $HOME/.bashrc \
    &&  echo export NODE_BUILD_NUM="$(curl https://hydra.iohk.io/job/Cardano/iohk-nix/cardano-deployment/latest-finished/download/1/index.html | grep -e "build" | sed 's/.*build\/\([0-9]*\)\/download.*/\1/g')" >> $HOME/.bashrc \
    &&  /bin/bash -c "source $HOME/.bashrc" \
    &&  mv $HOME/.local/bin/* /usr/local/bin/

RUN cabal update 

RUN cd $HOME/git \
    && git clone https://github.com/input-output-hk/cardano-node.git \
    && cd cardano-node \
    && git fetch --all --recurse-submodules --tags \
    && git checkout tags/1.24.2 
    
RUN cd $HOME/git/cardano-node \
    && export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" \
    && export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" \
    && cabal configure -O0 -w ghc-8.10.2 \
    && echo -e "package cardano-crypto-praos\n flags: -external-libsodium-vrf" > cabal.project.local \
    && sed -i $HOME/.cabal/config -e "s/overwrite-policy:/overwrite-policy: always/g" \
    && rm -rf $HOME/git/cardano-node/dist-newstyle/build/x86_64-linux/ghc-8.10.2 \
    && cabal build cardano-cli cardano-node \
    && cp $(find $HOME/git/cardano-node/dist-newstyle/build -type f -name "cardano-cli") /usr/local/bin/cardano-cli \
    && cp $(find $HOME/git/cardano-node/dist-newstyle/build -type f -name "cardano-node") /usr/local/bin/cardano-node