From 7136b079fd953d34390eb60260454d9507558908 Mon Sep 17 00:00:00 2001 From: Tyler Adam Martinez Date: Mon, 17 Nov 2025 12:14:11 -0600 Subject: [PATCH] [docker-compose] Add db healthcheck --- docker-compose.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7d7640672..9d3f1ebd2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,11 @@ services: - 5432:5432 volumes: - postgres_data:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"] + interval: 2s + timeout: 5s + retries: 20 app: build: @@ -27,11 +32,12 @@ services: ports: - 8000:8000 depends_on: - - db + db: + condition: service_healthy # <-- wait for DB to be ready links: - db volumes: - .:/app volumes: - postgres_data: \ No newline at end of file + postgres_data: