version : '3'

name: laravel-rabbitmq${VERSION}

networks:
  producer:
    external: true
  rabbitmq:
    driver: bridge
  socketio:
    driver: bridge
  redis:
    driver: bridge

services:
  consumer:
    build:
      context: ./consumer
      dockerfile: Dockerfile
    shm_size: '1GB'
    volumes:
      - ./chrome-profiles:/consumer/chrome-profiles
    ports:
      - :3389
      - :4000
    networks:
      - rabbitmq
    privileged: true
    restart: always

  redis:
    image: redis
    ports:
      - ":6379"
    networks:
      - redis

  # ----COMMON---- #
  producer:
    tty: true
    image: bitnami/laravel:9
    volumes:
      - ./producer:/producer
    command: "sh /producer/producer.sh"
    ports:
      - 800${VERSION}:8000
    networks:
      - rabbitmq
      - socketio
      - redis
    depends_on:
      - redis

  socketio:
    container_name: socketio
    build:
      context: ./.docker/socketio
      dockerfile: Dockerfile
    ports:
      - 3000:3000
    networks:
      - socketio

  rabbitmq:
    image: rabbitmq:3-management
    hostname: 'rabbitmq'
    container_name: 'rabbitmq'
    ports:
      - 5672:5672
      - 15672:15672
    environment:
      - RABBITMQ_DEFAULT_USER=rabbit
      - RABBITMQ_DEFAULT_PASS=rabbit123
    volumes:
      - ./.docker/rabbitmq/data:/var/lib/rabbitmq/
      - ./.docker/rabbitmq/log:/var/log/rabbitmq
    networks:
      - rabbitmq
