version: '3.2'

services:
    mnode:
        # Build properties
        build:
            context: .
            dockerfile: Dockerfile.mnode
        image: mnode_img
        # Deploy properties
        deploy:
            mode: replicated
            replicas: 1
            restart_policy:
                condition: on-failure
                delay: 5s
                max_attempts: 3
                window: 120s
        ports:
            - "6100:6100"
            - "6120:6120"
            - "6220:6220"
            - "6260:6260"
            - "6280:6280"
        volumes:
            - type: volume
              source: taos_data
              target: /var/lib/taos/
            - type: volume
              source: taos_log
              target: /var/log/taos/
              # And also configuration files.
        network_mode: bridge

    dnode:
        # Build properties
        build:
            context: .
            dockerfile: Dockerfile.dnode
        image: dnode_img
        # Deploy properties
        deploy:
            mode: replicated
            replicas: 1
            restart_policy:
                condition: on-failure
                delay: 5s
                max_attempts: 3
                window: 120s
        ports:
            - "6140:6140"
            - "6160:6160"
            - "6180:6180"
            - "6200:6200"
            - "6240:6240"
        volumes:
            - type: volume
              source: taos_data
              target: /var/lib/taos/
            - type: volume
              source: taos_log
              target: /var/log/taos/
              # And also configuration files.
        network_mode: bridge

    taos:
        # Build properties
        build:
            context: .
            dockerfile: Dockerfile.taos
        image: taos_img
        # Deploy properties

volumes:
    taos_data:
    taos_log:

# To build the images: docker-compose build
