From df49dcb74656c8d1148c6f649cd8522fa57eb92c Mon Sep 17 00:00:00 2001 From: Gabe Fierro Date: Sat, 11 Feb 2023 18:37:34 -0700 Subject: [PATCH] add dependencies and incorporate env vars into docker-compose file --- docker-compose.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 1e6d82f34..8705516ea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,14 +3,27 @@ services: db: container_name: buildingmotif-db image: postgres + environment: + - POSTGRES_DB=${POSTGRES_DB} + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} ports: - target: 5432 published: 5432 protocol: tcp mode: host + healthcheck: + test: ["CMD-SHELL", "pg_isready", "-d", "db_prod"] + interval: 30s + timeout: 30s + retries: 5 + start_period: 10s api: container_name: buildingmotif-api + depends_on: # require that the db is up and listening + db: + condition: service_healthy build: . image: buildingmotif-api:latest ports: @@ -22,6 +35,8 @@ services: app: container_name: buildingmotif-app + depends_on: # require that the api server has started + - api build: ./buildingmotif-app image: buildingmotif-app:latest ports: