version: '3.3'

services:
    node:
        build:
            context: ./node
            args:
                - NODE_VERSION=latest
                - PROJECT_PATH=/opt/app/
                - NODE_ENV=production
                - YARN=false
        volumes:
            - ../server:/opt/app
        entrypoint: run-nodock "knex migrate:latest && node build/bundle.js"
        ports:
          - "3000:3000"
        expose:
          - "3000"
        tty: true

    mysql:
        build:
            context: ./mysql

        volumes:
            - ../data/mysql/:/var/lib/mysql
        expose:
            - "3306"

    nginx:
        build:
            context: ./nginx
            args:
                - WEB_REVERSE_PROXY_PORT=3000
                - WEB_SSL=false
                - SELF_SIGNED=false
                - NO_DEFAULT=false
        volumes:
            - ../data/logs/nginx/:/var/log/nginx
            - ./certbot/certs/:/var/certs
            - ../client/dist/:/var/www/moosher
        ports:
            - "80:80"
            - "443:443"
        tty: true

    certbot:
        build:
            context: ./certbot
        links:
            - nginx
        volumes:
          - ./certbot/letsencrypt/:/var/www/letsencrypt
          - ./certbot/certs/:/var/certs