fix(docker): clear build cache on every build to stop unbounded disk growth
CI / check (push) Successful in 1m17s
CI / deploy (push) Successful in 2m11s

This commit is contained in:
openhands committed 2026-09-07 16:18:04 +02:00
1 parent 649e2f0663
commit a640e40a5d
2 files changed
+8

No files matched your search

+5
View File
@@ -74,6 +74,11 @@ pnpm install --frozen-lockfile
pnpm exec playwright install chromium pnpm exec playwright install chromium
echo "Building $image" 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 \ DOCKER_BUILDKIT=1 docker build --network=host --progress=plain --cache-from epicnext-cms:latest \
--build-arg NEXT_DEPLOYMENT_ID="$sha" -t "$image" . --build-arg NEXT_DEPLOYMENT_ID="$sha" -t "$image" .
check_current check_current
+3
View File
@@ -79,6 +79,9 @@ fi
log "Node major gate OK (major=${float_major:-?})" log "Node major gate OK (major=${float_major:-?})"
# --- 4. Rebuild the image --- # --- 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 docker compose build >>"$LOG_FILE" 2>&1 || die "docker compose build failed" 2
log "docker compose build OK" log "docker compose build OK"