From d9a540f8e8bb211c0d26e5d417576979adc39320 Mon Sep 17 00:00:00 2001 From: scott Date: Sun, 5 Apr 2026 11:53:32 -0400 Subject: [PATCH] Add registry layer cache and fix Dockerfile cache order - CI: cache-from/cache-to with mode=max stores all intermediate layers in the registry so subsequent builds skip unchanged layers (especially the slow ROCm PyTorch download) - Dockerfile: move COPY perth_stub.py below pip install layers so a stub change doesn't bust the cache for everything above it Co-Authored-By: Claude Sonnet 4.6 --- .gitea/workflows/build.yml | 2 ++ Dockerfile.rocm | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 71c1c71..9f62a15 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -31,3 +31,5 @@ jobs: tags: | git.sdgarren.com/scott/rocm-chatterbox-whisper:latest git.sdgarren.com/scott/rocm-chatterbox-whisper:${{ gitea.sha }} + cache-from: type=registry,ref=git.sdgarren.com/scott/rocm-chatterbox-whisper:buildcache + cache-to: type=registry,ref=git.sdgarren.com/scott/rocm-chatterbox-whisper:buildcache,mode=max diff --git a/Dockerfile.rocm b/Dockerfile.rocm index ef9a626..f94cc54 100644 --- a/Dockerfile.rocm +++ b/Dockerfile.rocm @@ -17,8 +17,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ WORKDIR /app -COPY perth_stub.py . - # Step 1: Install ROCm-compatible PyTorch stack first. # This must happen before anything else to prevent pip from pulling CPU wheels. COPY requirements-rocm-init.txt . @@ -32,7 +30,8 @@ RUN pip3 install -r requirements-rocm.txt RUN pip3 install --no-deps chatterbox-tts # Stub out resemble-perth (audio watermarking, unnecessary for self-hosted use). -# Install as 'perth' module to satisfy chatterbox's import. +# Placed after pip layers so changes to the stub don't bust the cache above. +COPY perth_stub.py . RUN python3 -c "import site; print(site.getsitepackages()[0])" | \ xargs -I{} cp /app/perth_stub.py {}/perth.py