feat: Add support for GitHub Actions to automatically build a docker image on push to master branch
- Initial version
-
This will initiate a build of the docker image automatically, through GitHub Actions, each time a commit is pushed into the
masterbranch. It requires that GitHub Actions be enabled and allowed to run on the repo. -
The output of the action will create a package in the GitHub Container Registry (visible initially only to admins here: https://github.com/orgs/HeyPuter/packages/container/puter/settings)
-
An admin of the org will need to make the initial version of the package public, by going to that page and scrolling all the way to the bottom of the page and clicking on "Change Visibility" red button, selecting
Public, then following the instructions.
Once this is done on the first build, subsequent builds will automatically be public.
The tagging logic is very simple for now, it will apply a tag for the sha of the image, another for the branch (so for now, only master) and another one for latest.
This last one can be controversial, as it means people can simply run docker run --rm -it -p 4000:4000 ghcr.io/puter/puter
(or the equivalent docker-compose) to get puter going, without having to pull the code/clone the repo, as this will be done on GH side automatically.
All those rules can be tweaked in the appropriate section of the .github/workflows/docker-image.yaml file (Lines 56 to 63 at the time of writing this).
Thank you for taking the time to read and consider this PR, I made it more for me originally, to simplify automated builds of puter from sources (get new features, bug and security fixes, work with containrrr's Watchtower, etc.), but I thought it could be useful for others :)
I'd also like to point out that a lot of projects have renamed their master branch to main, and that even GitHub now creates new repos with main as the name for the ... main... branch.
https://github.com/github/renaming
Thank you very much for your contribution. I think this would be a great addition. I'm looping @KernelDeimos in for comments and review.
As for the naming of the main branch. I'm changing it to main, I have no idea how it became master since I exclusively use github and its desktop app.
Thank you very much for your contribution. I think this would be a great addition. I'm looping @KernelDeimos in for comments and review.
You're welcome.
As for the naming of the main branch. I'm changing it to
main, I have no idea how it becamemastersince I exclusively use github and its desktop app.
If/when you do, the file added in this PR needs to be updated to reflect/track that new branch name.
Just changed the name. Will edit the file.
Moved this PR to https://github.com/HeyPuter/puter/pull/104 to reflect the main branch renaming.
Thank you @jelveh !