From c9fb57a20e6fc21efe0073343b8ff8b891cfc15f Mon Sep 17 00:00:00 2001 From: Dmitry Zenovich Date: Fri, 19 Jul 2024 04:22:11 +0300 Subject: [PATCH] wait for the db to start before running the app in Docker --- docker-compose.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 3547de51d..794f3b92e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,12 +16,19 @@ services: MYSQL_ROOT_HOST: "%" security_opt: - seccomp:unconfined + healthcheck: + test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"] + timeout: 20s + retries: 10 backend: build: . ports: - "8080:8080" links: - db + depends_on: + db: + condition: service_healthy environment: ALGOREA_ENV: dev ALGOREA_DATABASE__ADDR: db