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