services:
  mcserver:
    build: .
    env_file:
      - .env
    ports:
      - 8081:3000
    depends_on:
      - database
    restart: on-failure
    volumes:
      - ./data/skins:/opt/skins
      - ./data/cloaks:/opt/cloaks
  zookeeper:
    image: 'confluentinc/cp-zookeeper:latest'
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000
  kafka:
    image: 'confluentinc/cp-kafka:latest'
    environment:
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
    ports:
      - 9092:9092
  database:
    image: 'postgres:15'
    ports:
      - 5433:5432
    volumes:
      - ./data/db:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: mcserver
      POSTGRES_PASSWORD: GENERATE_A_STRONG_PASSWORD_HERE
      POSTGRES_DB: mcserver
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "mcserver"]
