From a0cdba97f231d41fb363357905ed052f566946c1 Mon Sep 17 00:00:00 2001 From: KingPin <28669+KingPin@users.noreply.github.com> Date: Wed, 11 Nov 2026 10:50:36 -0500 Subject: [PATCH] fix(docker): remove pip from runtime image pip is only needed to install requirements at build time. Its vendored urllib3, msgpack and setuptools packages raised 7 Trivy alerts (5 HIGH) on the published image. Uninstall it in the same layer as the install. --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b36963e..142ff26 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,8 +22,9 @@ RUN mkdir -p /logs # Set working directory WORKDIR /app -# Install Python dependencies with build tools, then remove build tools in -# the same layer so they do not bloat the final image. +# Install Python dependencies with build tools, then remove build tools and +# pip in the same layer. pip is not needed at runtime and its vendored +# packages (urllib3, msgpack, setuptools) trigger image CVE scans. COPY requirements.txt . RUN apk add --no-cache --virtual .build-deps \ gcc \ @@ -34,6 +35,7 @@ RUN apk add --no-cache --virtual .build-deps \ cmake \ make && \ pip install --no-cache-dir -r requirements.txt && \ + pip uninstall -y pip && \ apk del .build-deps # Copy the application code