version: '3'

services:

    # Documentation : https://docs.docker.com/samples/library/mongo/ 
    mongo:
        container_name: mongo
        image: mongo
        restart: always
        volumes:
            - "./data:/data/db" # get access to database files
        ports:
           - "27017:27017"
        networks:
            - backend
 
    backapp:
        container_name: backapp
        build:
            context: .
            dockerfile: back.Dockerfile
        image: backapp
        ports:
          - "${PORT:-5000}:5000"
        environment:
            NODE_ENV: "production"
            SERVE_CLIENT: "${SERVE_CLIENT:-true}"
            PORT: "5000"
            MONGO_URI: "${MONGO_URI:-mongodb://mongo:27017/sin3d}"
        links:
            - mongo
        volumes:
            - "${IMAGES_PATH:-./images}:/usr/src/app/images"
            - "./logs:/usr/src/app/logs"
        depends_on:
            - mongo
        networks:
            - backend

networks:
    backend:
