From 5eae2d1b56c45ed291a49ee71bcd5344128b6dd4 Mon Sep 17 00:00:00 2001 From: zorn Date: Sun, 29 Dec 2024 21:55:41 +1000 Subject: [PATCH] Wait while db container is started --- docker-compose.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 46e790e7..5f09d867 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,6 +7,11 @@ services: - MYSQL_DATABASE=touchh - MYSQL_USER=touchh - MYSQL_PASSWORD=${MYSQL_PASSWORD:-touchh} + healthcheck: + test: mariadb -utouchh -p${MYSQL_PASSWORD:-touchh} -e 'SELECT 1;' touchh + interval: 1s + timeout: 10s + retries: 10 volumes: - ./var/mysql:/var/lib/mysql bot: @@ -15,7 +20,9 @@ services: image: touchh-py restart: on-failure command: ['python3', 'manage.py', 'run_bot'] - depends_on: ['db'] + depends_on: + db: + condition: service_healthy stop_signal: SIGINT volumes: - .:/app