From 8140bc022ce317a37664f8bd9ae611639e25ccc4 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Wed, 1 Apr 2026 16:23:59 -0400 Subject: [PATCH] fix: resolve ENOSPC on CI by using BuildKit pip cache and registry layer cache - Add `# syntax=docker/dockerfile:1` to enable BuildKit cache mounts - Replace `--no-cache-dir` pip installs with `--mount=type=cache,target=/root/.cache/pip` so torch/CUDA wheels are reused across builds instead of re-downloaded every run - Add `docker system prune -f` step before build to free dangling image/layer space - Add `cache-from`/`cache-to` pointing to `:cache` tag so unchanged layers (including the heavy voice-deps layer) are pulled from registry instead of rebuilt Co-Authored-By: Claude Sonnet 4.6 --- .forgejo/workflows/ci.yml | 5 +++++ Dockerfile | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 557f119..0d145c3 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -121,6 +121,9 @@ jobs: echo "value=$TAGS" >> $GITHUB_OUTPUT echo "build_version=$BUILD_VERSION" >> $GITHUB_OUTPUT + - name: Free disk space + run: docker system prune -f || true + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 @@ -138,3 +141,5 @@ jobs: push: true tags: ${{ steps.tags.outputs.value }} build-args: BUILD_VERSION=${{ steps.tags.outputs.build_version }} + cache-from: type=registry,ref=${{ env.IMAGE }}:cache + cache-to: type=registry,ref=${{ env.IMAGE }}:cache,mode=max diff --git a/Dockerfile b/Dockerfile index 1d5d203..a2cd616 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 # Stage 1: Build Vue frontend FROM node:22-alpine AS build-frontend WORKDIR /build @@ -12,16 +13,20 @@ WORKDIR /app COPY pyproject.toml . COPY src/ src/ -RUN pip install --no-cache-dir . +RUN --mount=type=cache,target=/root/.cache/pip \ + pip install . # Voice dependencies (faster-whisper, Kokoro TTS, soundfile) — activated at runtime via VOICE_ENABLED -RUN pip install --no-cache-dir faster-whisper kokoro soundfile +# Cache mount keeps wheels across builds so the heavy torch/CUDA deps aren't re-downloaded every time. +RUN --mount=type=cache,target=/root/.cache/pip \ + pip install faster-whisper kokoro soundfile # Build the fable-mcp wheel so it can be served for download COPY fable-mcp/ fable-mcp/ -RUN pip install --no-cache-dir build hatchling \ +RUN --mount=type=cache,target=/root/.cache/pip \ + pip install build hatchling \ && python -m build --wheel ./fable-mcp --outdir /app/dist/ \ && pip uninstall -y build \ - && rm -rf fable-mcp/ /root/.cache/pip + && rm -rf fable-mcp/ COPY --from=build-frontend /build/dist/ src/fabledassistant/static/ COPY alembic.ini .