#     _
#  __| | __ _ _ __ ___   __ _ ___        ___ ___  _ __ ___
# / _` |/ _` | '_ ` _ \ / _` / __|_____ / __/ _ \| '__/ _ \
#| (_| | (_| | | | | | | (_| \__ \_____| (_| (_) | | |  __/
# \__,_|\__,_|_| |_| |_|\__,_|___/      \___\___/|_|  \___|
#
#
# Directory structure
# ├── compose.yaml this file
# ├── damas.json   damas configuration file
# ├── db/          mongo data storing JSON
# ├── extensions/  additional server extensions
# ├── nginx.conf   nginx configuration file
# └── www/         additional served files
#
# Run: docker compose up
# Open: http://localhost

services:
    damas:
        image: primcode/damas-core:2.6.3-beta1
        container_name: damas-core
        volumes:
            - ./damas.json:/damas-core/server-nodejs/conf.json
            - ./www:/app/www
            - ./extensions:/app/extensions
        environment:
            DEBUG: "damas:*"
            HTTP_PORT: 8090
        depends_on:
            - mongo
        restart: always
        stdin_open: true
        tty: true
        build:
            context: ..
            dockerfile: docker/Dockerfile
    mongo:
        image: mongo:latest
        container_name: damas-mongo
        volumes:
            - ./db:/data/db
        restart: always
        stdin_open: true
        tty: true
    nginx:
        image: nginx
        container_name: damas-nginx
        volumes:
            - ./nginx.conf:/etc/nginx/nginx.conf
            - /etc/letsencrypt/:/etc/letsencrypt/
        ports:
            - 80:80
            - 443:443
        depends_on:
            - damas
# add reverse proxy networks (multiple domains, one damas each)
#        networks:
#            - damas_default
