Nonroot container, that is smaller and builds faster #2
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.
Hi!
I made some adjustments to the Dockerfile to do the following:
The last one being the primary motivator. Making the image non-root improves the security profile of the image, and allows it to run in stricter k8s namespaces (tested) and should now also function in OpenShift (untested, see [1]). I believe this is important as these images might be exposed to the internet and as such should have basic security precautions taken.
As this change makes the container run with less privileges, users who run this container in a 'rootful' manner may need to adjust permissions on the (contents of) their user data volume.
[1]: For ownership of
/app/, the GID is set to 0, instead of the user's group, to be able to deal with the random user ID assignment strategy OpenShift applies: "The Container user is always a member of the root group, so it can read or write files accessible by GID=0" (A Guide to OpenShift and UIDs, W. C. Babilonia)