Skip to content

distroless nonroot runtime image - #312

Open
gerardrecinto wants to merge 1 commit into
masterfrom
distroless-nonroot-runtime
Open

distroless nonroot runtime image#312
gerardrecinto wants to merge 1 commit into
masterfrom
distroless-nonroot-runtime

Conversation

@gerardrecinto

Copy link
Copy Markdown
Collaborator

The production runtime image was still on alpine while Dockerfile.quickstart already runs distroless nonroot. Brought the main Dockerfile's runtime stage in line: gcr.io/distroless/static-debian12:nonroot, no shell, no package manager.

Distroless has no wget/shell, so the old HEALTHCHECK couldn't run as-is. Added tools/healthcheck, a small static binary that GETs /api/health and exits 0/1, wired into the HEALTHCHECK directive in exec form.

Verified locally:

  • docker run --entrypoint=/bin/sh fails, no shell in the image
  • Config.User is nonroot:nonroot
  • container reports healthy via Docker's own healthcheck within a few seconds of boot
  • go build ./... and go test ./tools/healthcheck/... -race clean

security.yml and deploy-azure.yml both already build --target runtime and Trivy-scan it, no workflow changes needed, and the smaller image should only help that gate.

…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.
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