version: '3.3'

services:

  mongodb:
    container_name: mongodb
    image: mongo
    restart: on-failure
    ports:
      - 27017:27017
    environment:
      - MONGO_INITDB_ROOT_USERNAME=root
      - MONGO_INITDB_ROOT_PASSWORD=root
      - PUID=1000
      - PGID=1000
    volumes:
      - evolution_mongodb_data:/data/db
      - evolution_mongodb_configdb:/data/configdb
    expose:
      - 27017

  mongo-express:
    container_name: mongodb-express
    image: mongo-express
    restart: on-failure
    ports:
      - 8081:8081
    depends_on:
      - mongodb
    environment:
      ME_CONFIG_BASICAUTH_USERNAME: root
      ME_CONFIG_BASICAUTH_PASSWORD: root
      ME_CONFIG_MONGODB_SERVER: mongodb
      ME_CONFIG_MONGODB_ADMINUSERNAME: root
      ME_CONFIG_MONGODB_ADMINPASSWORD: root
    links:
      - mongodb

  redis:
    container_name: redis
    image: redis:latest
    restart: on-failure
    ports:
      - 6379:6379
    command: >
      redis-server
      --port 6379
      --appendonly yes
    volumes:
      - evolution_redis:/data

  rebrow:
    container_name: rebrow
    image: marian/rebrow
    restart: on-failure
    depends_on:
      - redis
    ports: 
      - 5001:5001
    links:
      - redis

  api:
    container_name: evolution_api
    image: atendai/evolution-api
    restart: always
    depends_on:
      - mongodb
      - redis
    ports:
      - 8080:8080
    volumes:
      - evolution_instances:/evolution/instances
      - evolution_store:/evolution/store
    env_file:
      - .env
    command: ['node', './dist/src/main.js']
    expose:
      - 8080

volumes:
  evolution_mongodb_data:
  evolution_mongodb_configdb:
  evolution_redis:
  evolution_instances:
  evolution_store:

networks:
  evolution-net:
    external: true
  
