ci: 镜像清理改为仅限本项目旧 sha 版本(保留最近 5 个),不再使用全局 image prune 以免影响共享服务器上其他项目的悬空层
deploy-hxtesting / build-and-deploy (push) Successful in 1m51s
deploy-hxtesting / build-and-deploy (push) Successful in 1m51s
This commit is contained in:
1 parent
746ecfaa34
commit
035edaf3fe
1 file changed
+5
-1
@@ -36,7 +36,11 @@ jobs:
|
||||
WITH_ANYDOC=0 bash scripts/build_images.sh -f
|
||||
docker tag wechatopenai/weknora-app:latest wechatopenai/weknora-app:sha-${GIT_SHA}
|
||||
docker tag wechatopenai/weknora-ui:latest wechatopenai/weknora-ui:sha-${GIT_SHA}
|
||||
docker image prune -f --filter "until=168h" >/dev/null
|
||||
# 仅清理本项目旧版本镜像(保留最近 5 个 sha-* 备回滚),不影响服务器上其他项目
|
||||
for repo in wechatopenai/weknora-app wechatopenai/weknora-ui; do
|
||||
docker images --format '{{.Tag}}' "$repo" | grep '^sha-' | tail -n +6 \
|
||||
| xargs -r -I{} docker rmi "$repo:{}" >/dev/null 2>&1 || true
|
||||
done
|
||||
|
||||
- name: 部署(compose up)
|
||||
run: |
|
||||
|
||||
Reference in new issue
Block a user