From ca96e3461fd28d047e05c6207278d5b217690ab5 Mon Sep 17 00:00:00 2001 From: jason Date: Mon, 29 Jun 2026 23:07:42 -0500 Subject: [PATCH] docker-build.yml: push :latest only + clean up host build images - drop per-commit :sha tag (registry stays one tag per repo) - remove the built image and prune dangling layers after push so CI builds stop accumulating orphan images on the Unraid host --- .gitea/workflows/docker-build.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/docker-build.yml b/.gitea/workflows/docker-build.yml index 3352a1a..980a799 100644 --- a/.gitea/workflows/docker-build.yml +++ b/.gitea/workflows/docker-build.yml @@ -7,9 +7,7 @@ on: jobs: build: - # Run directly on the forgerunner host: the bundled Docker CLI and the - # mounted /var/run/docker.sock are available, so no nested-container or - # socket juggling is needed. + # Runs on the forgerunner host: bundled Docker CLI + mounted /var/run/docker.sock. runs-on: host steps: - name: Checkout @@ -26,6 +24,15 @@ jobs: run: | # gitea.repository is already "owner/repo" (e.g. jason/breedr). IMAGE="registry.alwisp.com/${{ gitea.repository }}" - docker build -t "${IMAGE}:latest" -t "${IMAGE}:${{ gitea.sha }}" . + docker build -t "${IMAGE}:latest" . docker push "${IMAGE}:latest" - docker push "${IMAGE}:${{ gitea.sha }}" + + - name: Clean up build images on host + # Builds use the host Docker daemon, so the built image and replaced + # layers stay on the Unraid host unless removed. Drop our tag and prune + # dangling layers to stop orphan images piling up on the array. + if: always() + run: | + IMAGE="registry.alwisp.com/${{ gitea.repository }}" + docker image rm -f "${IMAGE}:latest" 2>/dev/null || true + docker image prune -f 2>/dev/null || true