version: "2"

services:

  ui:
    build: ./ui
    networks:
      - cloudcms
    depends_on:
      - ui1
      - ui2
    ports:
      - "80:80"
      - "8085:8085"
    expose:
      - "80"

  ui1:
    build: ./ui1
    networks:
      - cloudcms
    depends_on:
      - api
      - activemq
    env_file:
      - ./ui1/ui.env

  ui2:
    build: ./ui2
    networks:
      - cloudcms
    depends_on:
      - api
      - activemq
    env_file:
      - ./ui2/ui.env

  api:
    build: ./api
    networks:
      - cloudcms
    depends_on:
      - mongodb
      - elasticsearch
      - activemq
    env_file:
      - ./api/api.env
    ports:
      - "8080:8080"

  mongodb:
    build: ./mongodb
    networks:
      - cloudcms
    ports:
      - "27017:27017"
    command: mongod --config /etc/mongod.conf

  elasticsearch:
    build: ./elasticsearch
    networks:
      - cloudcms
    environment:
      - "cluster.name=cloudcms-docker"
      - "transport.host=elasticsearch"
      - "network.host=elasticsearch"
      - "discovery.type=single-node"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    ports:
      - "9300:9300"
      - "9200:9200"

  activemq:
    build: ./activemq
    networks:
      - cloudcms
    env_file:
      - ./activemq/activemq.env
    ports:
      - "8161:8161"
      - "61613:61613"
      - "61616:61616"

  redis:
    build: ./redis
    networks:
      - cloudcms

networks:
  cloudcms:
    driver: bridge
