From c12935de9c7f6868e03c8b58aa4fc235992d3ddb Mon Sep 17 00:00:00 2001 From: Flea Flicker Date: Thu, 21 May 2026 21:09:40 +0000 Subject: [PATCH] fix(docker): add healthcheck + depends_on condition on web service Previously web started immediately after the api container launched, not after it was ready. Playwright tests then hit the web server before the nginx process had fully started, causing connection refused errors. Now: - api has a 30s startup grace via start_period and 20 retries - web waits for api to be healthy (not just started) - both services verify readiness before dependent steps proceed Co-Authored-By: Paperclip --- docker-compose.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 756282d..cfc2d0a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,6 +43,12 @@ services: condition: service_healthy migrate: condition: service_completed_successfully + healthcheck: + test: ["CMD-SHELL", "curl -f http://localhost:3000/health || exit 1"] + interval: 5s + timeout: 5s + retries: 20 + start_period: 10s web: build: @@ -53,7 +59,14 @@ services: extra_hosts: - "host.docker.internal:host-gateway" depends_on: - - api + api: + condition: service_healthy + healthcheck: + test: ["CMD-SHELL", "curl -f http://localhost:80 || exit 1"] + interval: 5s + timeout: 5s + retries: 20 + start_period: 10s volumes: postgres_data: