Skip to content

Commit f75b0ba

Browse files
candrewsDavidAnson
andauthored
Update Dockerfile-rules to use user ID (vs. name) for consistency with Dockerfile and to work beter with Kubernetes.
Co-authored-by: David Anson <[email protected]>
1 parent 4923b9b commit f75b0ba

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

docker/Dockerfile-rules

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
ARG VERSION
44
FROM davidanson/markdownlint-cli2:${VERSION}
55

6-
USER root
6+
USER 0
7+
# 0 is the documented user ID for the "root" user: https://www.docker.com/blog/understanding-the-docker-user-instruction
78

89
RUN npm install --global --no-package-lock --production \
910
@github/markdownlint-github \
@@ -25,4 +26,6 @@ RUN npm install --global --no-package-lock --production \
2526
markdownlint-rules-grav-pages \
2627
sentences-per-line
2728

28-
USER node
29+
USER 1000
30+
# 1000 is the documented user ID for the unprivileged "node" user: https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#non-root-user
31+
# Kubernetes running as non-root requires user ID (implied by the docs for "runAsUser"): https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#securitycontext-v1-core

0 commit comments

Comments
 (0)