feat: Add support for GitHub Actions to automatically build a docker image on push to master branch
- Updated version to reflect
mainbranch renaming.
Initial PR (now closed) here: https://github.com/HeyPuter/puter/pull/102
-
This will initiate a build of the docker image automatically, through GitHub Actions, each time a commit is pushed into the
mainbranch. 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 :)
@jelveh please continue here from https://github.com/HeyPuter/puter/pull/102.
You had tagged @KernelDeimos to review this (in this comment: https://github.com/HeyPuter/puter/pull/102#issuecomment-1998708373), so I'm taking the liberty to tag him again.
Thank you for renaming the branch!
Also, CLA had been signed on the previous PR (closed due to branch renaming), linking that here too: https://github.com/HeyPuter/puter/pull/102#issuecomment-1998685345
@shuguet Thank you very much for your contribution!
@shuguet Thank you very much for your contribution!
You're welcome :)
Also, @jelveh, can you also follow step 3 of the instruction in the first message of this PR? This:
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.
Otherwise, the package/container image will not be visible :(
The good news is, it works! 2 successful builds already, the one triggered from the merge of the PR, and another one right after that! https://github.com/HeyPuter/puter/actions/workflows/docker-image.yaml
The good news is, it works!
It sure does! thanks to you :)
I just set the package visibility to public. We should be all set now.
Can confirm, we're all set!:
$ docker run --rm -p 4000:4000 ghcr.io/heyputer/puter
> [email protected] start
> nodemon --exec "node dev-server.js"
[nodemon] 2.0.22
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,json,mjs,jsx,svg,css
[nodemon] starting `node dev-server.js`
-----------------------------------------------------------
Puter is now live at: http://localhost:4000
-----------------------------------------------------------