distroless nonroot runtime image - #312
Open
gerardrecinto wants to merge 1 commit into
Open
Conversation
…hat quickstart already does pulled sop-server down to gcr.io/distroless/static-debian12:nonroot, same base the quickstart image already runs on. no shell, no package manager, no wget, so the old HEALTHCHECK couldn't work as-is, added a tiny static healthcheck binary (tools/healthcheck) that just GETs the health endpoint and exits 0/1, wired it into the HEALTHCHECK directive in exec form. verified locally: no /bin/sh in the image, runs as nonroot:nonroot, container reports healthy through docker's own healthcheck within a few seconds of boot.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The production runtime image was still on alpine while
Dockerfile.quickstartalready runs distroless nonroot. Brought the mainDockerfile's runtime stage in line:gcr.io/distroless/static-debian12:nonroot, no shell, no package manager.Distroless has no wget/shell, so the old
HEALTHCHECKcouldn't run as-is. Addedtools/healthcheck, a small static binary that GETs/api/healthand exits 0/1, wired into theHEALTHCHECKdirective in exec form.Verified locally:
docker run --entrypoint=/bin/shfails, no shell in the imageConfig.Userisnonroot:nonroothealthyvia Docker's own healthcheck within a few seconds of bootgo build ./...andgo test ./tools/healthcheck/... -racecleansecurity.ymlanddeploy-azure.ymlboth already build--target runtimeand Trivy-scan it, no workflow changes needed, and the smaller image should only help that gate.