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 .