From fca05aecc2c97c639b7954a7ecf15cd375bdb60d Mon Sep 17 00:00:00 2001 From: Diego Surita Date: Sat, 10 Feb 2024 13:07:12 -0300 Subject: [PATCH] build: add docker health check on mysql container --- docker-compose.yaml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 31c8ece..a204341 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,4 @@ -version: '3.8' +version: "3.8" services: node: @@ -11,7 +11,8 @@ services: expose: - "3000" depends_on: - - db + db: + condition: service_healthy nginx: image: nginx:1.25.3-alpine @@ -33,4 +34,10 @@ services: - ./bootstrap.sql:/docker-entrypoint-initdb.d/1.sql environment: MYSQL_ROOT_PASSWORD: "root" - MYSQL_DATABASE: fullcycle \ No newline at end of file + MYSQL_DATABASE: fullcycle + healthcheck: + test: ["CMD", "mysqladmin", "-uroot", "-proot", "ping", "-hlocalhost"] + interval: 5s + timeout: 10s + retries: 3 + start_period: 3s