From 7e61b269a9a875e6286e2c799c099b70ed79c781 Mon Sep 17 00:00:00 2001 From: Alexander Tarasov Date: Thu, 10 Sep 2026 14:24:52 +0200 Subject: [PATCH] fix(docker): Install into an explicit venv instead of the base image layout The main branch image build has been failing since the mirrored DHI base images were rebuilt: they moved Python out of `/opt/python` (`sysconfig` now reports `purelib=/usr/lib/python3.13/site-packages`, `scripts=/usr/bin` in both the `-dev` and runtime variants), so the runtime stage's `COPY --from=build /opt/python/...` fails with "not found". Rather than repoint the copy at `/usr`, install into a venv at `/opt/venv` that we own and copy that across. The build no longer depends on an internal layout of the upstream image, so a future base rebuild can't move the target again. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01Upx9gbisaXaMAwh8ToUQXx --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 17c1d23..33fb385 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,12 +3,12 @@ FROM us-docker.pkg.dev/sentryio/dhi-mirror/python:3.13-debian13-dev AS build COPY py/ /app/py/ # Install `bigquery` extra to enable the `bigquery_fetcher` entrypoint -RUN pip install --no-cache-dir "/app/py[bigquery]" +RUN python3 -m venv /opt/venv && /opt/venv/bin/pip install --no-cache-dir "/app/py[bigquery]" FROM us-docker.pkg.dev/sentryio/dhi-mirror/python:3.13-debian13 -COPY --from=build /opt/python/lib/python3.13/site-packages /opt/python/lib/python3.13/site-packages +COPY --from=build /opt/venv /opt/venv USER nonroot -ENTRYPOINT ["/opt/python/bin/python3", "-m", "usageaccountant.datadog_fetcher"] +ENTRYPOINT ["/opt/venv/bin/python3", "-m", "usageaccountant.datadog_fetcher"]