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 <noreply@anthropic.com>
This commit is contained in:
@@ -121,6 +121,9 @@ jobs:
|
|||||||
echo "value=$TAGS" >> $GITHUB_OUTPUT
|
echo "value=$TAGS" >> $GITHUB_OUTPUT
|
||||||
echo "build_version=$BUILD_VERSION" >> $GITHUB_OUTPUT
|
echo "build_version=$BUILD_VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Free disk space
|
||||||
|
run: docker system prune -f || true
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v4
|
uses: docker/setup-buildx-action@v4
|
||||||
|
|
||||||
@@ -138,3 +141,5 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.tags.outputs.value }}
|
tags: ${{ steps.tags.outputs.value }}
|
||||||
build-args: BUILD_VERSION=${{ steps.tags.outputs.build_version }}
|
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
|
||||||
|
|||||||
+9
-4
@@ -1,3 +1,4 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
# Stage 1: Build Vue frontend
|
# Stage 1: Build Vue frontend
|
||||||
FROM node:22-alpine AS build-frontend
|
FROM node:22-alpine AS build-frontend
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
@@ -12,16 +13,20 @@ WORKDIR /app
|
|||||||
|
|
||||||
COPY pyproject.toml .
|
COPY pyproject.toml .
|
||||||
COPY src/ src/
|
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
|
# 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
|
# Build the fable-mcp wheel so it can be served for download
|
||||||
COPY fable-mcp/ fable-mcp/
|
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/ \
|
&& python -m build --wheel ./fable-mcp --outdir /app/dist/ \
|
||||||
&& pip uninstall -y build \
|
&& 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 --from=build-frontend /build/dist/ src/fabledassistant/static/
|
||||||
COPY alembic.ini .
|
COPY alembic.ini .
|
||||||
|
|||||||
Reference in New Issue
Block a user