Files
interview-demo-code/scripts/wait_for_containers.sh
Nikita Kiselev 5439e8ef9a
Some checks failed
Telegram Mini App Shop Builder / Compute version metadata (push) Has been cancelled
Telegram Mini App Shop Builder / Run Frontend tests (push) Has been cancelled
Telegram Mini App Shop Builder / Run Backend tests (push) Has been cancelled
Telegram Mini App Shop Builder / Run PHP_CodeSniffer (push) Has been cancelled
Telegram Mini App Shop Builder / Build module. (push) Has been cancelled
Telegram Mini App Shop Builder / release (push) Has been cancelled
Squashed commit message
2026-03-11 22:08:52 +03:00

29 lines
537 B
Bash
Executable File

#!/bin/bash
SERVICES=("web" "mysql")
function check_containers {
for service in "${SERVICES[@]}"; do
if ! docker compose ps $service | grep "Up" > /dev/null; then
return 1
fi
done
return 0
}
echo "Waiting for docker containers..."
MAX_WAIT_TIME=60
WAIT_TIME=0
while ! check_containers; do
if [ $WAIT_TIME -ge $MAX_WAIT_TIME ]; then
echo "Containers have not started within $MAX_WAIT_TIME seconds. Exit."
exit 1
fi
sleep 1
WAIT_TIME=$((WAIT_TIME + 1))
done
echo "All docker containers executed."