From 8fa31313443bf13d0518371bce202d27dd716f77 Mon Sep 17 00:00:00 2001 From: "soroush.asadi" Date: Sun, 31 May 2026 23:37:06 +0330 Subject: [PATCH] ci: scope image prune to drsousan only, never touch other projects Co-Authored-By: Claude Sonnet 4.6 --- .gitea/workflows/ci-cd.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/ci-cd.yml b/.gitea/workflows/ci-cd.yml index 6020c5d..a952dab 100644 --- a/.gitea/workflows/ci-cd.yml +++ b/.gitea/workflows/ci-cd.yml @@ -56,7 +56,7 @@ jobs: working-directory: DrSousan.Api run: dotnet build DrSousan.Api.csproj --no-restore -c Release - # ── CD: build image → push to Nexus → deploy (push to main only) ──────────── + # ── CD: build image → deploy locally (push to main only) ─────────────────── deploy: name: "Deploy · drsousan" runs-on: self-hosted @@ -109,6 +109,12 @@ jobs: if: always() run: docker compose ps - - name: Prune old images + - name: Prune old drsousan images if: success() - run: docker image prune -f + # Only remove untagged (dangling) drsousan images — never touches other projects + run: | + docker images --format '{{.Repository}}:{{.Tag}} {{.ID}}' \ + | grep '^mirror\.soroushasadi\.com/drsousan/' \ + | grep '' \ + | awk '{print $2}' \ + | xargs -r docker rmi || true