version: "3"

services:
  zookeeper:
    image: wurstmeister/zookeeper
    container_name: zookeeper
    ports:
      - "2182:2182"
    networks:
      - kafka_network

  kafka:
    image: wurstmeister/kafka
    container_name: kafka
    ports:
      - "9092:9092"
    environment:
      KAFKA_ADVERTISED_HOST_NAME: kafka
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_BOOTSTRAP_SEVERS: kafka:9092
    networks:
      - kafka_network

  user-microservice:
    image: user-microservice:1.0
    container_name: user-microservice
    depends_on:
      - kafka
      - zookeeper
    networks:
      - kafka_network

  product-microservice:
    image: product-microservice:1.0
    container_name: product-microservice
    depends_on:
      - kafka
      - zookeeper
    networks:
      - kafka_network
      
networks:
  kafka_network:
    driver: bridge