From a640e40a5d5a2cc99df2c40e735e5c946a9299e2 Mon Sep 17 00:00:00 2001 From: openhands Date: Mon, 7 Sep 2026 16:18:04 +0200 Subject: [PATCH] fix(docker): clear build cache on every build to stop unbounded disk growth --- scripts/ci-deploy.sh | 5 +++++ scripts/docker-update.sh | 3 +++ 2 files changed, 8 insertions(+) diff --git a/scripts/ci-deploy.sh b/scripts/ci-deploy.sh index 9830330e..0e1cb157 100644 --- a/scripts/ci-deploy.sh +++ b/scripts/ci-deploy.sh @@ -74,6 +74,11 @@ pnpm install --frozen-lockfile pnpm exec playwright install chromium echo "Building $image" +# Throw away the previous build cache before each build so disk usage doesn't +# grow unbounded across deployments. The current release image (`epicnext-cms`) +# is still reused as a base layer via `--cache-from`; only the accumulated +# BuildKit intermediate cache is discarded. +docker builder prune -af --filter "until=1h" --keep-storage=0 2>/dev/null || true DOCKER_BUILDKIT=1 docker build --network=host --progress=plain --cache-from epicnext-cms:latest \ --build-arg NEXT_DEPLOYMENT_ID="$sha" -t "$image" . check_current diff --git a/scripts/docker-update.sh b/scripts/docker-update.sh index 9f714f0c..88252241 100755 --- a/scripts/docker-update.sh +++ b/scripts/docker-update.sh @@ -79,6 +79,9 @@ fi log "Node major gate OK (major=${float_major:-?})" # --- 4. Rebuild the image --- +# Reset the BuildKit cache first so the build doesn't accumulate unbounded +# layers on disk across daily rebuilds. +docker builder prune -af --filter "until=1h" --keep-storage=0 2>>"$LOG_FILE" || true docker compose build >>"$LOG_FILE" 2>&1 || die "docker compose build failed" 2 log "docker compose build OK"