Repository navigation
build(docker): Run the image on distroless to cut OS vulnerabilities - #166
Merged
Merged
Conversation
Co-Authored-By: Armen Zambrano Gasparnian <44410+armenzg@users.noreply.github.com>
armenzg
approved these changes
Nov 9, 2026
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.
Nearly all of the image's Grype findings come from Debian packages in
python:3.15.2-slimthat the app never uses, such as perl, ncurses, and apt. None come from our Python dependencies. When one of those packages gets a fix upstream before the base image does, the scan fails. That's what is happening now withzlib1g.The image now runs on
gcr.io/distroless/cc-debian13:nonroot. It has glibc and the C++ runtime that grpcio needs, but no shell, package manager, or perl. Distroless has no Python, so the builder installs a uv-managed Python under/pythonand copies it over with the venv. Tcl/Tk, pip, headers, and docs get removed first.Local Grype scan of each image:
zlib1g), soonly-fixed+severity-cutoff: highfails.The image is about the same size (191 MB vs 189 MB). Most of that is the venv. The
Test startingcheck gets its 400. grpc, Secret Manager, cryptography, and ssl all import. The app runs as uid 65532 instead ofnobody.Trade-offs to consider:
docker exec … shno longer works. The distroless:debugtags add busybox if that's ever needed.pythonbinary, so fixes to those bundled libraries come with new Python builds, not Debian updates.UV_PYTHON=3.15) is pinned. The patch release is whatever the pinned uv release installs, so Dependabot's uv image bumps now bring Python patch updates. Before, Dependabot bumped thepython:tag.distroless/cc-debian13:nonrootis a moving tag, so each Cloud Build picks up the latest OS fixes. Dependabot won't propose changes to it.via @armenzg.
--
View Session [Sentry]