Skip to content

Run container as non-root user#33

Merged
botre merged 1 commit into
masterfrom
dockerfile/run-as-non-root
May 26, 2026
Merged

Run container as non-root user#33
botre merged 1 commit into
masterfrom
dockerfile/run-as-non-root

Conversation

@botre

@botre botre commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a dedicated httphq user (UID/GID 1001) to the runner stage of the Dockerfile and chowns /app so SQLite can still write local.db relative to WORKDIR.
  • Unblocks deployment under a restricted Kubernetes PodSecurity policy (securityContext.runAsNonRoot: true).

Closes the request to run the container as a non-root user.

Test plan

  • docker build . succeeds.
  • docker run --rm --user 1001:1001 <image> starts cleanly, id reports uid=1001(httphq), and /api/health responds OK.

Add a dedicated httphq user (UID/GID 1001) in the runner stage so the
image can be deployed under a restricted Kubernetes PodSecurity policy
(runAsNonRoot: true). /app is chowned to the new user so SQLite can
still write local.db relative to WORKDIR.
@botre botre merged commit 4bc60ba into master May 26, 2026
2 checks passed
@botre botre deleted the dockerfile/run-as-non-root branch May 26, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant