Jump to content
Sign in to follow this  
buzzkillb

How to Make a Denarius Ubuntu Daemon Docker Container

Recommended Posts

How to setup a compiled from source Denarius daemon docker container in Ubuntu 16.04.

I setup an Ubuntu 16.04 VM using Virtual Box to start this out. Work in progress as there are a few steps and links I need to add over time.

Install Docker on your host machine.

https://docs.docker.com/install/linux/docker-ce/ubuntu/

create a folder to work in

mkdir denarius-ubuntu

First we setup the update and install dependencies files.

nano Dockerfile.dev
FROM ubuntu:16.04
RUN apt-get update -y && \
        apt-get dist-upgrade -y && \
        apt-get install -y git \
        unzip \
        build-essential \
        libssl-dev \
        libdb++-dev \
        libboost-all-dev \
        libqrencode-dev \
        libminiupnpc-dev \
        libgmp-dev \
        libevent-dev \
        autogen \
        automake \
        libtool

Then we build this

docker build -f Dockerfile.dev -t ubuntu-dev .

Next we setup getting the source code.

nano Dockerfile.build
FROM ubuntu-dev
RUN git clone https://github.com/carsenk/denarius

Then we build this

docker build -f Dockerfile.build -t denarius-ubuntu-build .

Setup the compile

nano Dockerfile.compile
FROM denarius-ubuntu-build
RUN (cd denarius && \
git checkout master && \
git pull && \
cd src && \
make -f makefile.unix )

Then we build this

docker build -f Dockerfile.compile -t denarius-ubuntu-compile .

Setup the move binary

nano Dockerfile.install
#Dockerfile.install
FROM denarius-ubuntu-compile
COPY --from=denarius-ubuntu-compile /denarius/src/denariusd /usr/local/bin

Then we build this

docker build -f Dockerfile.install -t denarius-ubuntu-bin .

Setup a denarius.conf.

nano denarius.conf
rpcuser=RandomUserNameSy5pess55rGu9EsGF0+ZXc/RZlON41+x
rpcpassword=RandomPasswordREy9PYjgNdmFdDgWmpXnsotQ42cURu4cO22xknJEXsItXkydbSa0kxcxbvt2hE+g
nativetor=1
server=1
listen=1
daemon=1

Setup to move the denarius.conf and expose ports.

nano Dockerfile.run
#Dockerfile.run
FROM denarius-ubuntu-bin
 
#
# Copy the denarius.conf file from
# the build context into the container
#
COPY denarius.conf /root/.denarius/denarius.conf


#
# Expose ports for the RPC interface
#
EXPOSE 33369 9999

Then we build this.

docker build -f Dockerfile.run -t denarius-ubuntu-run .

Now we have a bunch of images, which we can see by using the command docker images.

I liked the idea of running the container and linking to a directory on the host machine itself. Sample directory being ~/blockchain on the host.

docker run --rm -it -d -v ~/blockchain:/root/.denarius -P denarius-ubuntu-run bash

Finally if you want to remove some of the bloat and push to your own docker hub create a Dockerfile.

nano Dockerfile
FROM denarius-ubuntu-bin as build

RUN echo "In build stage"

FROM ubuntu:16.04

COPY --from=build /usr/local/bin/denariusd /usr/local/bin

#Get packages and Dependencies
RUN apt-get update -y && \
        apt-get dist-upgrade -y && \
        apt-get install -y git \
        unzip \
        build-essential \
        libssl-dev \
        libdb++-dev \
        libboost-all-dev \
        libqrencode-dev \
        libminiupnpc-dev \
        libgmp-dev \
        libevent-dev \
        autogen \
        automake \
        libtool

#Pull from Source
#RUN git clone https://github.com/carsenk/denarius

#Compile from Source
#RUN (cd denarius && \
#git checkout master && \
#git pull && \
#cd src && \
#make -f makefile.unix )

#
# Copy the denarius.conf file from
# the build context into the container
#
COPY denarius.conf /root/.denarius/denarius.conf


#
# Expose ports for the RPC interface
#
EXPOSE 33369 9999

#
# Start the bitcoin server
#
#ENTRYPOINT ["/usr/local/bin/denariusd"]

Build and commit this. A good step by step on how to push your new docker image to docker hub.
https://ropenscilabs.github.io/r-docker-tutorial/04-Dockerhub.html

Share this post


Link to post
Share on other sites

Playing around with Ubuntu 18 compile. Anyone know how to compile in Alpine??

https://cloud.docker.com/repository/docker/buzzkillb/denariusd

FROM ubuntu:18.04 as builder
LABEL author="buzzkillb"
RUN apt-get update && apt-get install -y \
    git \
    wget \
    unzip \
    automake \
    build-essential \
    libdb++-dev \
    libboost-all-dev \
    libqrencode-dev \
    libminiupnpc-dev \
    libevent-dev \
    autogen \
    automake \
    libtool \
    make \
 && rm -rf /var/lib/apt/lists/*
RUN (wget https://www.openssl.org/source/openssl-1.0.1j.tar.gz && \
    tar -xzvf openssl-1.0.1j.tar.gz && \
    cd openssl-1.0.1j && \
    ./config && \
    make install && \
    ln -sf /usr/local/ssl/bin/openssl `which openssl` && \
    cd ~)
RUN (git clone https://github.com/carsenk/denarius && \
    cd denarius && \
    git checkout master && \
    git pull && \
    cd src && \
    OPENSSL_INCLUDE_PATH=/usr/local/ssl/include OPENSSL_LIB_PATH=/usr/local/ssl/lib make -f makefile.unix)

# final image
FROM ubuntu:18.04

RUN apt-get update && apt-get install -y \
    automake \
    build-essential \
    libdb++-dev \
    libboost-all-dev \
    libqrencode-dev \
    libminiupnpc-dev \
    libevent-dev \
    libtool \
 && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/ssl/bin/openssl /usr/local/ssl/bin/openssl
RUN ln -sf /usr/local/ssl/bin/openssl `which openssl`
COPY --from=builder /denarius/src/denariusd /usr/local/bin/
EXPOSE 33369 9999

Sample Commands

docker run --name=fortunastake --rm -it -d -v ~/.denarius:/root/.denarius -P denariusd
docker ps
docker exec -ti 04a53c0913a9 bin/bash

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...