phanpy/Dockerfile
Victoria Nadasdi f3818f6681
feat: add Docker image build on prod release and publish to ghcr.io
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
2024-04-16 18:40:29 +02:00

16 lines
408 B
Docker

from node:21-alpine as builder
workdir /code
copy . /code
run npm ci && npm run build
from nginx:1.25.4-alpine
label maintainer="Victoria Nadasdi <efertone@pm.me>"
label org.opencontainers.image.source=https://github.com/cheeaun/phanpy
label org.opencontainers.image.description="Docker Image for Phanpy"
label org.opencontainers.image.licenses=MIT
copy --from=builder /code/dist /usr/share/nginx/html