From b01e4e5bbe81cbbffdaec6213fe72838c11d0ccc Mon Sep 17 00:00:00 2001 From: Donkie Date: Sun, 11 Oct 2026 12:02:59 +0200 Subject: [PATCH] Give each platform its own uv cache in the image build The parallel per-platform builds shared one uv cache mount, so they queued on uv's cache lock. When uv.lock changed, the emulated armv7 sync held it long enough for the others to hit uv's 300 s lock timeout and fail publish-images. --- Dockerfile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 003a8226..51a93aca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,12 @@ FROM python:3.14-slim-bookworm AS python-builder +# A multi-platform build runs this stage once per platform in parallel. Each gets +# its own uv cache: wheels are per-platform anyway, and one shared cache made the +# platforms queue on uv's cache lock until the slow emulated armv7 sync pushed the +# others past uv's 300 s lock timeout whenever uv.lock changed. +ARG TARGETARCH +ARG TARGETVARIANT + ENV UV_COMPILE_BYTECODE=1 ENV UV_LINK_MODE=copy ENV UV_NO_DEV=1 @@ -21,7 +28,7 @@ RUN pip install --no-cache-dir uv # Install dependencies WORKDIR /home/app/spoolman -RUN --mount=type=cache,target=/root/.cache/uv \ +RUN --mount=type=cache,id=uv-${TARGETARCH}${TARGETVARIANT},target=/root/.cache/uv \ --mount=type=bind,source=uv.lock,target=uv.lock \ --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ uv sync --locked --no-install-project \ @@ -45,7 +52,7 @@ RUN if [ "$(uname -m)" = "armv7l" ]; then \ COPY migrations /home/app/spoolman/migrations COPY spoolman /home/app/spoolman/spoolman COPY alembic.ini README.md uv.lock pyproject.toml /home/app/spoolman/ -RUN --mount=type=cache,target=/root/.cache/uv \ +RUN --mount=type=cache,id=uv-${TARGETARCH}${TARGETVARIANT},target=/root/.cache/uv \ uv sync --locked \ && uv cache prune --ci