Skip to content

Commit 2dfe114

Browse files
committed
health
1 parent ee68860 commit 2dfe114

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,16 @@ jobs:
9191
env:
9292
VPS_IP: ${{ secrets.VPS_IP }}
9393
run: |
94-
health_status=$(sshpass -p "${{ secrets.SSH_PASSPHRASE }}" ssh -o StrictHostKeyChecking=no docker@${VPS_IP} "docker inspect --format '{{json .State.Health.Status}}' $(docker ps -q -f name=api)")
94+
health_status=$(sshpass -p "${{ secrets.SSH_PASSPHRASE }}" ssh -o StrictHostKeyChecking=no docker@${VPS_IP} << 'EOF'
95+
container_id=$(docker ps -q -f name=api)
96+
if [ -z "$container_id" ]; then
97+
echo "No container found with name 'api'."
98+
exit 1
99+
else
100+
docker inspect --format '{{json .State.Health.Status}}' "$container_id"
101+
fi
102+
EOF
103+
)
95104
if [[ "$health_status" != "\"healthy\"" ]]; then
96105
echo "API container is unhealthy! Status: $health_status"
97106
exit 1

0 commit comments

Comments
 (0)