chainguard-images / images

Public Chainguard Images
https://chainguard.dev/chainguard-images
Apache License 2.0
548 stars 151 forks source link

[node] Add init system #271

Open eddiezane opened 1 year ago

eddiezane commented 1 year ago

Node.js was not designed to run as PID 1 and doing so causes headaches.

We should explore adding an init system of some sort -- the node docs recommend tini.

https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#handling-kernel-signals

https://github.com/krallin/tini#using-tini

eddiezane commented 1 year ago

Slack discussion suggests we use the apko s6 builtin service for this.

patflynn commented 1 year ago

@amouat does moving this image to use the same s6 service make sense to prioritze? I think the image is slightly broken as is. https://github.com/chainguard-images/images/blob/main/images/nginx/configs/latest.apko.yaml

amouat commented 1 year ago

Yes, it probably does. I remember the Docker Node images never respond to signals etc

amouat commented 1 year ago

I did have a brief look at this before and I'm not sure how to solve it. The issue is that the base image doesn't really need to start with an init system, it's the images that are built on top of this. Maybe we could create a clever entrypoint or some best practices on how to achieve this?

amouat commented 1 year ago

I don't think I can do much with this at this time, but it is something to be aware of and improve if we can.