version: '2.2'

services:
  keycloak:
    build: custom/keycloak
    command: start --optimized
    env_file:
      - /etc/ixvd/secrets/env/keycloak.env
    depends_on:
      - kcdb
    environment:
      KC_HOSTNAME: my.ixvd.net
      KC_PROXY: edge
      KC_HTTP_ENABLED: "true"
      KC_HTTP_PORT: "80"
      KC_DB: postgres
      KC_DB_URL: jdbc:postgresql://kcdb:5432/keycloak
      KC_DB_USERNAME: keycloak
      KC_DB_PASSWORD: keycloak
    networks:
      - proxy
      - keycloak

  kcdb:
    image: postgres:16
    environment:
      POSTGRES_USER: keycloak
      POSTGRES_PASSWORD: keycloak
      POSTGRES_DB: keycloak
    volumes:
      - /srv/keycloak/other/database:/var/lib/postgresql/data
    networks:
      - keycloak

networks:
  keycloak: