清理镜像
All checks were successful
build and push / build-and-push (push) Successful in 1m40s

This commit is contained in:
编码猿
2025-10-07 03:39:37 +08:00
parent 88cb2ae02b
commit ec31306c9c

View File

@@ -61,6 +61,13 @@ jobs:
script: |
# 拉取刚打包的最新镜像
docker pull registry.bmycode.help/app-product:${{ github.sha }}
echo '清理旧的 镜像...'
# 删除除了本次 github.sha 和 latest 之外的所有 镜像
docker images registry.bmycode.help/app-product --format 'table {{.Repository}}:{{.Tag}}' | \
grep -v 'registry.bmycode.help/app-product:${{ github.sha }}' | \
grep 'registry.bmycode.help/app-product' | \
xargs -r docker rmi -f || true
- name: 管理节点部署到 Swarm
uses: appleboy/ssh-action@v1