lautenberger / elmfire

Eulerian Level set Model of FIRE spread
https://elmfire.io
Eclipse Public License 2.0
23 stars 11 forks source link

Add github workflow for pushing to docker hub #8

Closed fitnr closed 1 year ago

fitnr commented 1 year ago

This adds a github workflow that automatically pushes a new version of the elmfire docker image whenever commits are pushed to the main branch.

The script pushes to both github packages and dockerhub, but to push to dockerhub, the repo must have two secrets: DOCKERHUB_USERNAME and DOCKERHUB_TOKEN. The username would be clauten, the token must be created on docker hub. How to add a secret to the repo: https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository

An example of the image on Github Packages can be found here. You can pull and inspect with:

$ docker pull ghcr.io/fitnr/fitnr/elmfire:latest

The build/docker directory is removed because it has been replaced by the automated workflow. For simplicity, the Dockerfile has been moved to the root of the repo. I also moved apt-get clean to the same build step as apt-get install, which will reduce overall image size.

The image size could be further reduced by using an intermediate build so that the final build only contains the elmfire executables. Additionally, I would suggest directories not needed in the image to .dockerignore. I only included the docs folder to be conservative.

fitnr commented 1 year ago

Is there a strong reason for the plain executables (e.g. elmfire) to be removed and replaced named versions (elmfire_2023.0427?) Having just a plain version name would make using elmfire inside a container much simpler.

Currently, it looks like the version name is hardcoded into the build script, which makes it hard to use in automated tools.

lautenberger commented 1 year ago

@fitnr - Thanks for the PR. Since main continued to evolve over the last month it was less time consuming to add most of this manually rather than merge the PR into main.