This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
feat: Add support for GitHub Actions to automatically build a docker image on push to main branch #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This will initiate a build of the docker image automatically, through GitHub Actions, each time a commit is pushed into the
main
branch. 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.js/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 8080:8080 ghcr.io/HeyPuter/puter.js
(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 :)