Wait while db container is started

This commit is contained in:
zorn
2024-12-29 21:55:41 +10:00
parent abcc032394
commit 5eae2d1b56

View File

@@ -7,6 +7,11 @@ services:
- MYSQL_DATABASE=touchh - MYSQL_DATABASE=touchh
- MYSQL_USER=touchh - MYSQL_USER=touchh
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-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: volumes:
- ./var/mysql:/var/lib/mysql - ./var/mysql:/var/lib/mysql
bot: bot:
@@ -15,7 +20,9 @@ services:
image: touchh-py image: touchh-py
restart: on-failure restart: on-failure
command: ['python3', 'manage.py', 'run_bot'] command: ['python3', 'manage.py', 'run_bot']
depends_on: ['db'] depends_on:
db:
condition: service_healthy
stop_signal: SIGINT stop_signal: SIGINT
volumes: volumes:
- .:/app - .:/app