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.
Fixes #207
Supersedes #214
Thanks @CommanderTvis
With some Copilot help I adjusted it again and executed both your test script and
docker-compose up --build(note: the test script is not really needed, you can run docker compose like that) and it works for me:Also finally found the official doc: https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#non-root-user
A funny side-note: The UID/GID 1000 you came up before/had used already corresponds already to the
nodeuser so your Dockerfile kinda already was inconsistent here?I am still not quite sure though why #214 did not work as I see no big differences in how I do it here.
Important note: From my experience when user have deployed this image somewhere and mounted some data in, the users of your app also may sometimes need to adjust the UID/GID/user e.g. if
/dbis mounted somewhere. However, I'd argue better to do that change now rather than later and settle on the good and apparently well-known UI/GID 1000 (= usernode)