version: '3.8'

services:
    mongodb:
        container_name: mongodb
        image: mongo:latest
        restart: unless-stopped
        ports:
            - 27017:27017
        volumes:
            - db:/data/db
    app:
        container_name: api
        build:
            context: .
            dockerfile: Dockerfile
            args:
                - PORT=${PORT}
        depends_on:
            - mongodb
        restart: unless-stopped
        env_file: .env
        ports:
            - ${PORT}:${PORT}
        environment:
            - TOKEN=${TOKEN}
            - PORT=${PORT}
            - MONGODB_ENABLED=${MONGODB_ENABLED}
            - MONGODB_URL=mongodb://mongodb:27017
            - WEBHOOK_ENABLED=${WEBHOOK_ENABLED}
            - WEBHOOK_URL=${WEBHOOK_URL}
            - WEBHOOK_BASE64=${WEBHOOK_BASE64}
        volumes:
            - ./:/home/node/app
            - /home/node/app/node_modules/

volumes:
    db:
