Using Dhive with Docker

There are multiple ways to use Dhive with Docker. If you want to run Dhive within a Docker setup and potentially connect the Docker container to other containerized, compatible blockchain binaries, refer to the guide on building a Docker image containing the Dhive binary. Alternatively, if you wish to generate a binary for use outside of Docker while ensuring the correct dependencies are used by building within a Docker container, proceed to the section on building the Dhive binary with Docker.

Note

The provided instructions have been tested on Ubuntu 18.04.2 LTS with Docker 20.10.2 and macOS 13.2.1 with Docker 20.10.22.

Prerequisites

Install Docker

General Setup

To build Dhive binaries with Docker, perform the following steps:

  1. Clone the Dhive repository to your local machine:

    git clone [email protected]:dhive/dhive.git
  2. Checkout the commit, branch, or release tag you wish to build:

    git checkout v11.0.2

Building a Docker Image Containing the Binary

To build a Docker image containing the Dhive binary, navigate to the cloned repository and run the following command in a terminal session:

make build-docker

This command creates an image named tharsishq/dhive with the version tag latest. The dhived binary can now be executed within the container, for example, to check its version:

docker run -it --rm tharsishq/dhive:latest dhived version

Building the Binary with Docker

It is possible to deterministically build the dhived binary using Docker. Docker’s containerized environment enables the creation of a Dhive binary in an isolated setting.

Building the Image

Run the following command to initiate a build for all supported architectures (currently linux/amd64):

make distclean build-reproducible

The build system generates both the binaries and a deterministic build report within the artifacts directory. The artifacts/build_report file contains a list of the build artifacts along with their respective checksums, which can be used to verify the build’s integrity. Below is an example of the file’s contents:

App: dhived
Version: 11.0.2
Commit: 8eeeac7ae42a5b2695fea7f56868f3c6e9bc2378
Files:
 6b5939adfd9a8ce964d78fcaab16091a  dhived-11.0.2-linux-amd64
 ac503925c535ddb8ee0fbebbb96d0eb9  dhived-11.0.2.tar.gz
Checksums-Sha256:
 0857d59c285a87b7d354aa6d566db90c56663d938a88d41d35415da490708aea  dhived-11.0.2-linux-amd64
 5005814fc34abc02d7e30dcfbe67e363c1b593efb774e0c97ebb7ec713baf306  dhived-11.0.2.tar.gz

Builder Image

The Tendermint builder Docker image provides a deterministic build environment for building Cosmos SDK applications, including Dhive. It ensures that the executables are genuinely compiled from the Git source, utilizing consistent, tested dependencies that are statically built into the executable.

Last updated

Was this helpful?