version: '3.7'
services: 
  keycloak-casa-db:
    image: postgres
    ports:
      - 5432:5432
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: keycloak
    volumes:
      - db:/var/lib/postgresql/data

  casa-user-data-service:
    build:
      context: https://github.com/UPHRH-platform/casa-user-data-service.git#main
    image: casa-user-data-service
    ports:
      - 3000:3000
      
  keycloak-casa:
    image: keycloak-casa
    build: ./keycloak-casa
    depends_on:
      - keycloak-casa-db
      - casa-user-data-service
    ports:
      - 8080:8080 
    environment:
      KC_DB_URL: jdbc:postgresql://keycloak-casa-db:5432/keycloak
      KC_DB_USERNAME: postgres
      KC_DB_PASSWORD: postgres
      KC_HOSTNAME: locahost
      KC_DB: postgres
      KEYCLOAK_ADMIN: admin
      KEYCLOAK_ADMIN_PASSWORD: admin
    command:
      - "start-dev"

volumes:
  db:

