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.
This commit is contained in:
Donkie committed 2026-10-11 12:02:59 +02:00
1 parent bcf340bdc7
commit b01e4e5bbe
1 file changed
+9 -2
+9 -2
View File
@@ -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