Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

shuguet
Copy link

@shuguet shuguet commented Mar 16, 2024

  • Initial version
  1. 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.

  2. 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)

  3. 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 :)

Also add missing `http-server` dependancy into the package.json file
@shuguet
Copy link
Author

shuguet commented Mar 16, 2024

Tagging @jelveh and @KernelDeimos for visibility/review.

Thank you for your consideration.

Once the backend piece (/socket.io/*) will be open-sourced, the same kind of "treatment" would be helpful.

Also, at that point, a single docker-compose.yml file composed of the 3 services (the SPA/puter, the JS/puter.js and the backend or kernel, whatever you end up naming that) would be neat, as it would allow people to simple run docker compose up -d and get started on an entire local deployment of the stack, entirely self-hosted.

Likely the best course of action for this, given your project isn't a monorepo, is to have a repo dedicated to this "unified" docker compose yaml file and instructions on 100% self-hosting, including production ready, scale-out backend, generating SSL certificates (Let's Encrypt or ZeroSSL via acme.sh or certbot + Nginx and/or Traefik as reverse-proxy, or similar).

I can help with that, just let me know if help is needed :)

@KernelDeimos
Copy link
Collaborator

Hello, I think this fell off our radar because we were focusing really hard on the main repo after we released full self-hosting.

In an effort to make puter.js easier to develop we're moving it into that repository, which is part of a higher-level effort to move toward a monolithic repository. This change will occur very soon; I'm working on it at this very moment.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants