-
-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add Docker image build on prod release and publish to ghcr.io #501
base: main
Are you sure you want to change the base?
Conversation
This patch add a simple Docker image that builds the application with node and puts the end result into a small nginx image. Updtaed the prod release GitHub action to build and publish the image on GitHub's OCI registry (ghcr.io) and connect it to the repository. Why? Docker is fun, more and more people deploy images on their homelab, Docker Swarm, or Kubernetes clusters. I do the same. First I build a builder for myself[^1], then I had a "waaaaait a minute...." moment and realised I can upstream it and put it here. Another options for the GitHub action: I can move the whole build to a separate workflow and trigger on new tag and instead of building the application, just download the artifact from the release page on GitHub (like my version[^2] does on manual trigger). [^1]: https://github.com/yitsushi/phanpy-docker/pkgs/container/phanpy-docker [^2]: https://github.com/yitsushi/phanpy-docker/blob/main/.github/workflows/build-and-publish.yaml
If you think this can live in the official repo, please let me know if you prefer a separate GH action for the build and publish or keep it in the same prod release workflow. |
It's very similar to #466 with the addition of GitHub workflow. I'm happy with either solutions, I just prefer to have a docker image and building on promotion makes it less painful to release. Why I opened this PR? Because I was lazy and didn't check if there is an open PR for that, I only checked if it has an official docker image or not. Feel free to close in favor of that PR. |
Thanks for the PR! I thought about this and thinking that it would be better if this is done separately from official repo, as I'm not the one maintaining this and I don't plan to spend time or learn how to maintain this 😬. This would allow different docker images of Phanpy, and I'll put a section linking them on the README. The GitHub action does make sense as I wonder how you guys are going to sync the new builds/versions/updates. So, questions:
Tagging folks from #466 @AlyxPink @burntcookie90 @benjaoming |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! This is also the recipe, I've followed and tested. Bravo @yitsushi 👏
If you can have a look here, it'd be nice to have some follow-up discussion around security headers in Nginx: #479
Edit: While I see nothing wrong in the PR itself, I can see reasons why an official Docker image is less preferable to having a Dockerfile template as documentation. Especially because npm run build
accepts a lot of important customizations to the build.
GitHub actions doesn't allow cross repository triggers, all repositories I worked on resolved this by a cron-job that checks if there is a new release on the upstream repo.
Totally makes sense, I'll just set one up for myself with a cron job to auto build. Right now it's manual, I added the rss feed of the repo's release page to my reader and when a new one is release I just kick off a new build. |
I'm with you on this one @Phanpy - building this image isn't complicated, and to be able to use Docker build-args could be a nice way to customize features - or just straight-up editing the I probably wouldn't use an "official" Docker image released from the repo, exactly because having your own Dockerfile (nice to be able to copy from a documentation template), can give the flexibility needed to tweak small things easily. So to suggest a simplification here, it would be to move the Dockerfile that @yitsushi suggests into the documentation and then continue to work on this template as "best practice" until maybe one day there's a strong reason to push it as an officially maintained docker image. |
Well I prefer official1 images because I can spin up a test container to see how it works, deploy easily without the need of
I'll not build docker images on the server my applications running, if I'm not at a computer where I can build one, the application will not be updated until I can sit down somewhere to build it (that's why I spend extra time creating github actions with manual triggering2). It's a lot more work and resources if I can access my raspberry and build there because that's arm and my VPS is not arm, so that's That's a lot of extra work instead of just using an image, even get notifications when new image is available and just update the image tag. Footnotes
|
Created a Discussion, I think that's more easier to follow and fits more: #511 |
This patch add a simple Docker image that builds the application with node and puts the end result into a small nginx image.
Updtaed the prod release GitHub action to build and publish the image on GitHub's OCI registry (ghcr.io) and connect it to the repository.
Why?
Docker is fun, more and more people deploy images on their homelab, Docker Swarm, or Kubernetes clusters. I do the same. First I build a builder for myself1, then I had a "waaaaait a minute...." moment and realised I can upstream it and put it here.
Another options for the GitHub action:
I can move the whole build to a separate workflow and trigger on new tag and instead of building the application, just download the artifact from the release page on GitHub (like my version2 does on manual trigger).
Footnotes
https://github.com/yitsushi/phanpy-docker/pkgs/container/phanpy-docker ↩
https://github.com/yitsushi/phanpy-docker/blob/main/.github/workflows/build-and-publish.yaml ↩