networks:
  net:
    driver: bridge

volumes:
  postgres_data_testbed:

services:
  db:
    image: postgres:latest
    container_name: postgres-testbed
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DB}
    env_file:
      - .env
    ports:
      - 5532:5432
    networks:
      - net
    volumes:
      - postgres_data_testbed:/var/lib/postgresql/data

  keycloak:
    image: quay.io/keycloak/keycloak:26.4.0
    container_name: keycloak-testbed
    command: start-dev
    environment:
      KC_DB: postgres
      KC_DB_URL_HOST: db
      KC_DB_USERNAME: ${POSTGRES_USER}
      KC_DB_PASSWORD: ${POSTGRES_PASSWORD}
      KC_DB_DATABASE: ${POSTGRES_DB}
      KC_DB_SCHEMA: public
      KC_BOOTSTRAP_ADMIN_USERNAME: ${KEYCLOAK_ADMIN}
      KC_BOOTSTRAP_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD}
    env_file:
      - .env
    ports:
      - 7080:8080
    depends_on:
      - db
    networks:
      - net
