From c6eb328db087d769d1f26834df31d09c61343b5a Mon Sep 17 00:00:00 2001 From: Alexander Tarasov Date: Thu, 10 Sep 2026 13:42:04 +0200 Subject: [PATCH] build(docker): Install dependencies into a venv The dhi-mirror python base images moved the interpreter prefix from /opt/python to /usr, so the runtime stage's COPY of /opt/python/bin/granian no longer resolves and the master image build fails with "failed to compute cache key". The Dockerfile itself has not changed since June; the floating 3.13-debian13 tags were rebuilt underneath it. Install requirements into /opt/venv and copy that single directory into the runtime stage instead of reaching into the base image's layout. The paths are now owned by this Dockerfile, so a future base image refresh that relocates site-packages cannot break the build again. Co-Authored-By: Claude Opus 5 (1M context) --- Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index db119fe..092e0a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,14 +5,13 @@ ENV PIP_NO_CACHE_DIR=off \ WORKDIR /usr/src/reload COPY requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt +RUN python3 -m venv /opt/venv && /opt/venv/bin/pip install --no-cache-dir -r requirements.txt FROM us-docker.pkg.dev/sentryio/dhi-mirror/python:3.13-debian13 # Python packages installed in the build stage -COPY --from=build /opt/python/lib/python3.13/site-packages /opt/python/lib/python3.13/site-packages -COPY --from=build /opt/python/bin/granian /opt/python/bin/granian +COPY --from=build /opt/venv /opt/venv COPY reload_app /usr/src/reload/reload_app @@ -22,4 +21,4 @@ EXPOSE 8000 USER nonroot -CMD ["/opt/python/bin/granian", "--interface", "wsgi", "--host", "0.0.0.0", "--port", "8000", "reload_app.wsgi:application"] +CMD ["/opt/venv/bin/granian", "--interface", "wsgi", "--host", "0.0.0.0", "--port", "8000", "reload_app.wsgi:application"]