services:
  local-kafka:
    image: docker.io/bitnami/kafka:3.9.0
    container_name: kafka
    ports:
      - 9092:9092
      - 9094:9094
    volumes:
      - ./config/kafka_data:/bitnami/kafka
    env_file:
      - config/kafka.env
    healthcheck:    
      test: ["CMD", "kafka-topics.sh", "--list", "--bootstrap-server", "localhost:9094"]
      interval: 30s
      timeout: 10s
      retries: 4

  kafdrop:
    container_name: kafdrop
    image: obsidiandynamics/kafdrop
    restart: "no"
    ports:
      - 9000:9000
    env_file:
      config/kafdrop.env
    depends_on:
      local-kafka:
        condition: service_healthy

  ervu-validate-recruits:
    image: registry-dev.pgs.rtlabs.ru/ervu/ervu-validate-recruits:0.0.1-sha51becef5
    container_name: validate-recruits
    depends_on:
      local-kafka:
        condition: service_healthy
    env_file:
      - config/ervu-validate-recruits.env

  ervu-organization-registry:
    image: registry-dev.pgs.rtlabs.ru/ervu/ervu-organization-registry:0.0.1-sha487d2691
    container_name: organization-registry
    depends_on:
      local-kafka:
        condition: service_healthy
    env_file:
      - config/ervu-organization-registry.env

  lkrp-av:
    image: registry-dev.pgs.rtlabs.ru/ervu/ervu-lkrp-av:0.0.1-sha071cf588
    container_name: lkrp-av
    depends_on:
      local-kafka:
        condition: service_healthy
    env_file:
      - config/ervu-lkrp-av.env

  lkrp-ul:
    container_name: lkrp-ul
    depends_on:
      local-kafka:
        condition: service_healthy
      ervu-validate-recruits:
        condition: service_started
      ervu-organization-registry:
        condition: service_started
      lkrp-av:
        condition: service_started
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - 8080:8080
    env_file:
      - config/local.env
