coti-io / coti-node

COTI is the first DAG based chain protocol that's optimized for Enterprises and Stable-coins.
https://coti.io
GNU General Public License v3.0
184 stars 23 forks source link

Add a GitHub Action to build Docker images #54

Closed tomjwells closed 1 year ago

tomjwells commented 1 year ago

This pull request includes a possible GitHub action (GHA) that automatically builds a Docker container image on each new official release, and pushes the generated image to a container repository.

The GHA is currently configured to push images to Dockerhub, but can be changed to push to the GitHub container registry (ghcr.io), or any other container registry.

A workflow triggered by the GHA is can be viewed here: https://github.com/tj-wells/coti-node-gha/actions/runs/4133513367

The image created as a result of that workflow can be found here: https://hub.docker.com/r/atomnode/coti-node-gha/tags

To test the image, that image is curretly being used to run my node (testnet.atomnode.tomoswells.com).

I included a script called create-properties in the pull request, which uses environment variables to create a fullnode.properties file, and downloads the appropriate clusterstamp file. This script is optional, since the fullnode.properties and clusterstamp file could in principle be included in the container using volume mounts. On the other hand, I think it’s convenient for node operators if everything needed to run the node can be defined in a single .env file. I’ll leave it up to the Coti team to decide whether to keep the script, or modify it.

I am happy to take any feedback/suggestions for chagnes to any parts of the code.

Thank you.

P.S. Two GitHub actions "secrets" need to be set in the repository settings for the workflow to run succesfully: DOCKERHUB_USERNAME, and ​​​​DOCKERHUB_TOKEN

P.P.S. An example docker-compose.yml file that can be used to run a node using images built with this method can be found here: https://github.com/tomjwells/coti-node