version: "2.3"
services:
    wildduck:
        build: ./wildduck
        hostname: wildduck
        container_name: wildduck
        restart: always
        entrypoint:
          - /bin/bash
          - /entrypoint.sh
        ports:
          - "25:25"
          - "587:587"
          - "993:993"
        expose:
          - 80
          - 12080
        volumes:
          - ./entrypoint.sh:/entrypoint.sh:ro
          - /opt/docker/secure:/secure:ro
          - ./wildduck/config:/wildduck/config
          - ./wildduck-mta/config:/wildduck-mta/config
          - ./haraka/config:/haraka/config
        depends_on:
          - redis
          - mongo
        networks:
          mynet:
            ipv4_address: 172.200.0.101

    redis:
        image: redis:alpine
        hostname: redis
        container_name: redis
        restart: always
        volumes:
          - ./redis:/data
        expose:
          - 6379
        networks:
          mynet:
            ipv4_address: 172.200.0.102
    
    mongo:
        image: mongo
        hostname: mongo
        container_name: mongo
        restart: always
        volumes:
          - ./mongodb:/data/db
        expose:
          - 27017
        networks:
          mynet:
            ipv4_address: 172.200.0.103

    webmail:
        build: ./webmail
        hostname: webmail
        container_name: webmail
        restart: always
        working_dir: /webmail
        entrypoint:
          - node
          - server.js
          - --config=/webmail/config/default.toml
        expose:
          - 3000
        volumes:
          - ./webmail/config:/webmail/config
          - ./webmail/views:/webmail/views
          - ./webmail/logo.png:/webmail/public/logo.png
        depends_on:
          - redis
          - mongo
          - wildduck
        networks:
          mynet:
            ipv4_address: 172.200.0.104


networks:
  mynet:
    driver: bridge
    ipam:
      config:
        - subnet: 172.200.0.0/24
