From dca3a5e547781b1943f3c5708406a31a5a683b8c Mon Sep 17 00:00:00 2001 From: Ashutosh Gangwar Date: Wed, 4 Oct 2023 16:26:15 +0530 Subject: [PATCH] clinic: add docker-compose config for running psql and hapi-fhir services --- clinic/docker-compose.yaml | 82 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 clinic/docker-compose.yaml diff --git a/clinic/docker-compose.yaml b/clinic/docker-compose.yaml new file mode 100644 index 0000000..2a2b830 --- /dev/null +++ b/clinic/docker-compose.yaml @@ -0,0 +1,82 @@ +version: "3.9" + +services: + postgres: + container_name: postgres + image: postgres:16 + environment: + POSTGRES_USER: admin + POSTGRES_PASSWORD: password + PGDATA: /data/postgres + volumes: + - postgres:/data/postgres + ports: + - "5432:5432" + networks: [default] + restart: unless-stopped + + pgadmin: + container_name: pgadmin + depends_on: + - postgres + image: dpage/pgadmin4 + environment: + PGADMIN_DEFAULT_EMAIL: admin@admin.org + PGADMIN_DEFAULT_PASSWORD: password + PGADMIN_CONFIG_SERVER_MODE: "False" + PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "False" + volumes: + - pgadmin:/root/.pgadmin + ports: + - "5433:80" + networks: [default] + restart: unless-stopped + + db-init: + container_name: db-init + depends_on: + - postgres + image: postgres:16 + environment: + PGHOST: postgres + PGPORT: 5432 + PGUSER: admin + PGPASSWORD: password + entrypoint: sh + command: + - -c + - | + while ! psql -c "select 1" >/dev/null 2>&1; do + sleep 1s + echo "waiting for postgres container..." + done + psql -c "drop database if exists hapi" + psql -c "create database hapi" + networks: [default] + + hapi-fhir: + container_name: hapi-fhir + depends_on: + db-init: + condition: service_completed_successfully + image: hapiproject/hapi:latest + environment: + spring.datasource.driverClassName: org.postgresql.Driver + spring.datasource.url: jdbc:postgresql://postgres:5432/hapi + spring.datasource.username: admin + spring.datasource.password: password + hapi.fhir.default_encoding: json + volumes: + - hapi-data:/data/hapi + ports: + - 8080:8080 + networks: [default] + +networks: + default: + driver: bridge + +volumes: + postgres: + pgadmin: + hapi-data: