version: "2"

services:

  ui:
    build: ./ui
    networks:
      - cloudcms
    depends_on:
      - api
      - activemq
    env_file:
      - ./ui/ui.env
    ports:
      - "80:80"
    volumes:
      - ~/projects/cloudcms-ui-server/public_build:/var/app/current/public_build
      - ~/projects/cloudcms-ui-server/public:/var/app/current/public
      - ./ui/ext:/var/app/current/ext

  api:
    build: ./api
    networks:
      - cloudcms
    depends_on:
      - mongodb
      - elasticsearch
      - activemq
    env_file:
      - ./api/api.env
    ports:
      - "8080:8080"
      - "5005:5005"
    volumes:
      - ~/projects/gitana/gitana-webapp-rest-docker/target/gitana-webapp-rest-docker-1.0.0-SNAPSHOT.war:/opt/tomcat/webapps/ROOT.war
      - ./api/ext/classes:/opt/tomcat/shared/classes
      - ./api/ext/lib:/opt/tomcat/shared/lib

  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"
      - "bootstrap.memory_lock=true"
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    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"

networks:
  cloudcms:
    driver: bridge
