From eb0fe6ed4e2ae93cf52468c596d182852a3fe9c8 Mon Sep 17 00:00:00 2001 From: amirdamirov <36473660+amirdamirov@users.noreply.github.com> Date: Wed, 31 Aug 2022 16:15:57 +0200 Subject: [PATCH] Update docker-comose file Lets add healthcheck here by this way node app will wait when postgres app will ready. --- docker-compose.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a8facdf06..92fcee335 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: depends_on: # Our app does not work without our database # so this ensures our database is loaded first - - postgres + condition: service_healthy ports: - "8080:8080" volumes: @@ -42,7 +42,11 @@ services: # provided in the `docker-entrypoint-initdb.d` directory, this connects # our seed file to that directory so that it gets run - ./database-seed.sql:/docker-entrypoint-initdb.d/database-seed.sql - + healthcheck: + test: ["CMD-SHELL", "pg_isready"] + interval: 10s + timeout: 5s + retries: 5 # PostgreSQL pgAdmin panel accessible at http://localhost:16543/ pgadmin-compose: image: dpage/pgadmin4