fix: verify preview through docker health
Verify mini program and deploy preview / verify-deploy (push) Successful in 24s

This commit is contained in:
2026-09-18 22:29:39 +08:00
parent 1261388fb8
commit fe8c43f14d
+6 -1
View File
@@ -43,6 +43,11 @@ jobs:
set -eu
docker rm -f pk-lab-xhs-preview 2>/dev/null || true
docker run -d --name pk-lab-xhs-preview --restart unless-stopped --read-only --tmpfs /tmp --tmpfs /var/cache/nginx --tmpfs /var/run -e API_BASE_URL="$API_BASE_URL" -p "$DEPLOY_PORT:8080" "pk-lab-xhs:$SOURCE_REVISION"
for i in 1 2 3 4 5 6; do curl -fsS "http://127.0.0.1:$DEPLOY_PORT/health" && exit 0; sleep 2; done
for i in 1 2 3 4 5 6 7 8 9 10; do
status="$(docker inspect --format '{{.State.Health.Status}}' pk-lab-xhs-preview)"
[ "$status" = healthy ] && exit 0
[ "$status" = unhealthy ] && break
sleep 2
done
docker logs pk-lab-xhs-preview
exit 1