ci: scope image prune to drsousan only, never touch other projects
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -56,7 +56,7 @@ jobs:
|
|||||||
working-directory: DrSousan.Api
|
working-directory: DrSousan.Api
|
||||||
run: dotnet build DrSousan.Api.csproj --no-restore -c Release
|
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:
|
deploy:
|
||||||
name: "Deploy · drsousan"
|
name: "Deploy · drsousan"
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
@@ -109,6 +109,12 @@ jobs:
|
|||||||
if: always()
|
if: always()
|
||||||
run: docker compose ps
|
run: docker compose ps
|
||||||
|
|
||||||
- name: Prune old images
|
- name: Prune old drsousan images
|
||||||
if: success()
|
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 '<none>' \
|
||||||
|
| awk '{print $2}' \
|
||||||
|
| xargs -r docker rmi || true
|
||||||
|
|||||||
Reference in New Issue
Block a user