Skip to content

Instantly share code, notes, and snippets.

@tmaiaroto
Created Apr 8, 2021
Embed
What would you like to do?
Hyrda Dockerfile
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
ARG TZ=America/Los_Angeles
RUN apt update -y
RUN apt upgrade -y
RUN apt -y install unzip build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils git cmake libboost-all-dev libgmp3-dev libzmq3-dev wget
RUN apt -y install software-properties-common
# install leveldb
RUN mkdir /root/dev
WORKDIR /root/dev
RUN wget -N http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
RUN tar -xvf db-4.8.30.NC.tar.gz
RUN sed -i s/__atomic_compare_exchange/__atomic_compare_exchange_db/g db-4.8.30.NC/dbinc/atomic.h
RUN ./db-4.8.30.NC/dist/configure --enable-cxx --prefix=/usr/local
RUN make && make install
RUN apt update -y
RUN apt-get -y install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler qrencode
# get hydra
WORKDIR /root
RUN mkdir -p Hydra
WORKDIR /root/Hydra
RUN wget -N https://github.com/Hydra-Chain/node/releases/download/hydra_v0.18.5.3/hydra-0.18.5.3-ubuntu20.04-x86_64-gnu.zip
RUN unzip -o hydra-0.18.5.3-ubuntu20.04-x86_64-gnu.zip
RUN mkdir ~/.hydra
RUN cp hydra.conf ~/.hydra/
# ports to expose
ARG TESTNET_PORT=1334
ARG MAINNET_PORT=3338
EXPOSE $TESTNET_PORT
EXPOSE $MAINNET_PORT
COPY ./run-hydrad.sh /root/Hydra/bin/run-hydrad.sh
ENV PATH="/root/Hydra/bin:${PATH}"
WORKDIR /root/Hydra/bin
RUN chmod +x ./run-hydrad.sh
CMD ["./run-hydrad.sh"]
#!/bin/bash
TESTNET=${TESTNET:-false}
STAKING=${STAKING:-0}
# the flag does NOT accept true/false it is 1/0
if [[ $STAKING = "true" ]]; then
STAKING=1
fi
echo ""
echo "starting node in daemon mode..."
echo ""
if $TESTNET; then
./hydrad -daemon -testnet -staking=${STAKING}
# not sure why this was in the installer/setup script, by the time someone gets a shell into the container similar time should pass
# and if running in Kubernetes, there's probes and delays
# sleep 20
echo "running on testnet, call the daemon with: ~/Hydra/bin/./hydra-cli -testnet getinfo"
else
./hydrad -daemon -staking=${STAKING}
# sleep 20
echo "running on mainnet, call the daemon with: ~/Hydra/bin/./hydra-cli getinfo"
fi
while true; do sleep 30; done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment