services:
  keycloak:
    image: quay.io/keycloak/keycloak:25.0.6
    command: start-dev
    depends_on:
      - postgres
    environment:
      - KEYCLOAK_ADMIN=admin
      - KEYCLOAK_ADMIN_PASSWORD=local
      - KC_DB=postgres
      - KC_DB_URL=jdbc:postgresql://postgres/keycloak
      - KC_DB_USERNAME=keycloak
      - KC_DB_PASSWORD=password
    ports:
      - "8080:8080"
    restart: always

  postgres:
    image: postgres:14-alpine
    volumes:
      - keycloak-postgres-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_USER=keycloak
      - POSTGRES_PASSWORD=password
      - POSTGRES_DB=keycloak
    ports:
      - "65430:5432"
    restart: always

volumes:
  keycloak-postgres-data:
