How to build a Vericoin Docker container For Docker Hub

Would it not be great to have Vericoin Docker container in Docker Hub who everyone can use. In this blog I am going to talk about putting Vericion Docker container in Docker Hub, based on Azure Pipeline agent on a Raspberry PI 4. We will end with running the Vericoin Docker container on our Raspberry PI 4 (or any other ARM based SBC)


Summary

In this blog I am explaining how I created the Vericoin Docker container in Docker Hub. In the previous blog I already talked how you get your container in Docker Hub, so for the details you can read that blog (How to create a Docker container in Docker Hub (Azure Pipeline agent)). At the end of this blog I explain how to run the docker container, so if you only want to run it, then skip to the end.


Prerequisites


How to setup github repository with the code

  • Go to https://github.com and create a new repository with the name Vericoin
  • Clone the repository to your own computer. For me it is the most easy way to say in github to ‘Open with Visual Studio’, but any way of cloning it to local is fine.
  • Now add the files from the previous blog ‘How to run a Azure Pipeline agent in Docker container on a Raspberry PI’ and push it to your repository. The file you need to add you can find here ‘https://github.com/johanthedeveloper/vericoin/tree/blogs/vericoincontainer‘. Files you need to add are:
    • dockerfile – This is the docker file we use to build the Docker container
    • scripts/bootstrap.sh – This is checks if there is already data. If not then it will start the bootstrap download and unzip
    • scripts/setupconfig.sh – This script checks if the custom configuration is already there. If not it will create a default custom configuration file. In this custom configuration file you can set the wallet password and if you want to stake your coins. Default: FALSE
    • scripts/startup.sh – This is the script who is started by the Docker container on start. This script calls the other scripts to get started.
    • scripts/vericoind_startwithoutstake.sh – This script is used to start without staking
    • scripts/vericoind_startwithstake.sh – This script is used to start with staking
    • code/main.cpp – This code should be the same as the master of Vericoin code, but with a small exception to limit the number of block for each call (2000 instayed of 20000). This because the Raspberry PI with 4GB cannot handle the load.
    • code/makefile.unix – This code should be the same as master of Vericoin code, but with a small exception to get it building on ARM
    • azure-pipeline/ap-build-docker-arm.yml – This script is used to build the solution. So you can use this in the build pipeline to validate your code. Using the template.
    • azure-pipeline/ap-release-docker-arm.yml – This script is used to build and push the solution to dockerhub. Using the template.
    • azure-pipeline/ap-template-docker-buildimage.yml – This template is used to build the docker container for dockerhub.
    • azure-pipeline/ap-template-docker-pushimage.yml – This template is used to push the docker image to dockerhub.

Setup Docker Hub repository And Build Pipeline (Azure Devops)

  • Login into Docker Hub (https://dockerhub.com) and login
  • Click on ‘Create Repository’ and name the repository ‘Vericoin’

Setup Azure Project with build pipeline (Azure Devops)

  • Login into Azure Devops
  • Click on ‘New project’ and name the project ‘Vericoin’
  • Go to ‘Project settings’ – ‘Service connections’
  • Here you find all service connections you have. We need to add the service connection to docker hub.
  • Click on ‘Create service connection’ and then select ‘Docker Registry’.
  • Fill in your docker account and fill in as service connection name dockerhub_johanthedeloper
  • Verify and save the connection
  • Go to Pipeline – Pipeline – Create pipeline
  • Select Github. Select your github repository (you might to authorize)
  • Click on ‘Exsisting Azure Pipelines YAML file’
  • Choice master as branch and path to ‘/azure-pipelines/ap-build-docker-arm.yml’
  • Click on continue and then on Save (arrow down next to the Run button)
  • Click on Edit
  • Click on … and then on Triggers and go to YAML
  • Change:
    • Name to ‘Vericoin Build’
    • ‘Default agent pool for YAML’ to ‘WorkerPool’
  • Click on ‘Save & queue’ to save the pipeline and queue the new build

The build should succeed. You will find a new container on your docker hub location. In my place is that: https://hub.docker.com/repository/docker/johanthedeveloper/vericoin

How you can use the docker container you can find in the next blog here

© 2024 Johan the Developer . Powered by WordPress. Theme by Viva Themes.