15 lines
475 B
Bash
Executable File
15 lines
475 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
# Restart one API container at a time and wait for its healthcheck.
|
|
for container in $(docker compose --env-file .env ps -q api); do
|
|
docker restart "$container" >/dev/null
|
|
deadline=$(( $(date +%s) + 60 ))
|
|
while :; do
|
|
status=$(docker inspect --format '{{.State.Health.Status}}' "$container" 2>/dev/null || true)
|
|
[ "$status" = "healthy" ] && break
|
|
[ "$(date +%s)" -lt "$deadline" ] || exit 1
|
|
sleep 1
|
|
done
|
|
done
|