version: "2.0"
services:
    tmdb:
        hostname: tmdb
        container_name: tmdbc
        image: mariadb:5.5
        command: mysqld --sql_mode="NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES"
        restart: always
        ports:
            - "3306"
        environment:
            MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
            MYSQL_DATABASE: testdb
            MYSQL_USER: "albert"
            MYSQL_PASSWORD: "marcel"
            MYSQL_HOST: "localhost"
        volumes:
            - ./initdb/ami.sql:/docker-entrypoint-initdb.d/ami.sql

    amibin:
        build: amibin
        ports: ['8900']
        container_name: bserver
        image: amitm_bs
        links:
            - tmdb
        depends_on:
            - tmdb
        volumes:
            - albert:/opt/ami/
        tty: true

    crf:
        build: crf
        hostname: crf
        ports:
            - "8085"
            - "8086"
        container_name: crf
        image: amitm_crf
        environment:
            - PYTHONUNBUFFERED=1
        volumes:
            - ./config-bench.json:/opt/crf/config.json

    spacy:
        build: spacy
        hostname: spacy
        ports:
            - "8087"
            - "8088"
        container_name: spacy
        image: amitm_spacy
        environment:
            - PYTHONUNBUFFERED=1
        volumes:
            - ./config-bench.json:/opt/spacy/config.json

    amitm:
        build: amitm
        hostname: amitm
        ports: ['8081:8081']
        container_name: atm
        image: amitm_atm
        links:
            - amibin
            - crf
        depends_on:
            - amibin
            - crf
        command: "npm start"
        environment:
            CRF_HOST: "crf"
            SP_HOST: "spacy"
        volumes:
            - albert:/opt/amitm/ami/
            - ./config-bench.json:/opt/amitm/config.json
    demo:
        build: demo
        ports: ['8090:8090']
        container_name: demo
        image: amitm_demo
        links:
            - amitm
        depends_on:
            - amitm
        environment:
            - PYTHONUNBUFFERED=1
volumes:
    albert:
