version: "3.9"

services:
  connection-manager:
    build:
      context: ..
      args:
        - SERVICE=connection-manager
    init: true
    ports:
      - "3003:3003"
    env_file:
      ./env/connection-manager.env
    depends_on:
      - db
      - nats
      - ssi

  attestation-manager:
    build:
      context: ..
      args:
        - SERVICE=attestation-manager
    init: true
    ports:
      - "3005:3005"
    env_file:
      ./env/attestation-manager.env
    depends_on:
      - db
      - nats
      - ssi

  proof-manager:
    build:
      context: ..
      args:
        - SERVICE=proof-manager
    init: true
    ports:
      - "3007:3007"
    env_file:
      ./env/proof-manager.env
    depends_on:
      - db
      - nats
      - ssi

  ssi:
    build:
      context: ..
      args:
        - SERVICE=ssi-abstraction
    init: true
    ports:
      - "3009:3009"
      - "3010:3010"
      - "4000:4000"
    env_file:
      ./env/ssi-abstraction.env
    depends_on:
      - db
      - nats

  db:
    image: postgres:16
    volumes:
      - db-data:/var/lib/postgresql/data
    ports:
      - 5432:5432
    healthcheck:
      test: [ "CMD", "pg_isready", "-q", "-d", "postgres", "-U", "root" ]
      timeout: 45s
      interval: 10s
      retries: 10
    restart: always
    environment:
      - POSTGRES_USER=root
      - POSTGRES_PASSWORD=password

  nats:
    image: nats
    ports:
      - '4222:4222' #Nats server port
      - '8222:8222' #Nats server Monitering port

volumes:
  db-data:
