Skip to content

Add GitLab CI pipeline for dockerhub publishing

mainnet-pat requested to merge mainnet-pat/bitcoin-cash-node:issue_456 into master

Resolves #456

This MR adds the possibility to build multi-architecture docker images facilitating GitLab CI and publishing them on DockerHub.

This work is based on Josh Elithorpe's images which became standard in the broad dev community. Dockerfile is altered but the output is the same.

Docker image builds are triggered upon tag creation from any branch. Git tag name will become the docker image tag name.

What is changed:

  • New job deploy-release-docker is introduced, making use of gitian pre-release build artifacts at They are picked up and unpacked inside the corresponding architecture's image, checksums are verified. The images are built inside docker-in-docker service. If you happen to use your own runners, note that this job requires GitLab CI runners to be launched in privileged mode (see example in documentation). GitLab's shared runners are executed in privileged mode already.
  • New directory is created: contrib/gitlab-dockerhub-publish/. It contains Dockerfile and docker entrypoint file necessary to build the images. The docker image build happens in the context of this directory.

Required configuration:

  • DOCKERHUB_USER CI variable must be set in the repository.
  • DOCKERHUB_PASSWORD CI variable must be set and marked as masked in the repository.

To set the variables go to Settings -> CI/CD -> Variables -> Expand -> Add variable.

To set up Docker Hub, go to and create an account if necessary. Go to and create a public repository named bitcoin-cash-node. For enhanced security, instead of using your Docker Hub account's password you are advised to use an access token. Create one at

Test plan:

  1. Merge this code in master or any other branch.
  2. Create a new tag from this branch, see that new CI deployment jobs are present.
  3. Wait for jobs to finish.
  4. Verify that newly built multi-arch image has appeared in your Docker Hub repository.
  5. Verify that this image works on your system by executing for example the following docker run --rm mainnetpat/bitcoin-cash-node:v0.1.6 bitcoind --help.

See example CI job finished with successful deploy to

Edited by mainnet-pat

Merge request reports