version: '3.3'

services:
    truebits-invoice-ninja-cng-server:
        image: nginx
        container_name: truebits-invoice-ninja-cng-server
        restart: always
        volumes:
            # Vhost configuration
            #- ./config/caddy/Caddyfile:/etc/caddy/Caddyfiledocker-com
            - "/home/app/tools/invoice-ninja-cng/nginx:/etc/nginx/conf.d:rw,delegated"
            - "/home/app/tools/invoice-ninja-cng/public:/var/www/app/public:rw,delegated"
            - "/home/app/tools/invoice-ninja-cng/storage:/var/www/app/storage:rw,delegated"
        depends_on:
            - truebits-invoice-ninja-cng
        # Run webserver nginx on port 80
        # Feel free to modify depending what port is already occupied
        ports:
            - "72:80"
            #- "443:443"
        networks:
            - truebits-invoice-ninja-cng

    truebits-invoice-ninja-cng:
        image: invoiceninja/invoiceninja:5
        container_name: truebits-invoice-ninja-cng
        volumes:
            - "/home/app/tools/invoice-ninja-cng/public:/var/app/public:rw,delegated"
            - "/home/app/tools/invoice-ninja-cng/storage:/var/app/storage:rw,delegated"
        environment:
            - APP_ENV='production'
            - APP_DEBUG=false
            - APP_URL=http://172.105.92.91:72
            - APP_KEY='base64:axJQUo5Q0jYqlmafR0eBXjegjh87KJ8oIvQ/6wS+VAs='
            - APP_CIPHER='AES-256-CBC'
            - REQUIRE_HTTPS=false
            - PHANTOMJS_PDF_GENERATION=false
            - PDF_GENERATOR=snappdf
            - QUEUE_CONNECTION=database
            - DB_TYPE='mysql'
            - DB_STRICT='false'
            - DB_HOST=truebits-invoice-ninja-cng-db
            - DB_PORT=3306
            - DB_DATABASE='ninja_cng'
            - DB_USERNAME='ninja'
            - DB_PASSWORD='ninja#123'
            - IS_DOCKER=true
              # Create initial user
              # Default to these values if empty
            - IN_USER_EMAIL=mawasiliano@truebitstech.com
            - IN_PASSWORD=changeme!
            - IN_USER_EMAIL=
            - IN_PASSWORD=
        restart: always
        depends_on:
            - truebits-invoice-ninja-cng-db
        networks:
            - truebits-invoice-ninja-cng

    truebits-invoice-ninja-cng-db:
        image: mariadb:10.4
        container_name: truebits-invoice-ninja-cng-db
        ports:
            - "3305:3306"
        restart: always
        volumes:
            - "/home/app/tools/invoice-ninja-cng/mysql/data:/var/lib/mysql:rw,delegated"
        environment:
            - MYSQL_ROOT_PASSWORD=ninjaPA55w0rd
            - MYSQL_USER=ninja
            - MYSQL_PASSWORD=ninja#123
            - MYSQL_DATABASE=ninja_cng
        #entrypoint: |
        #    /bin/sh -c 'mysql -u root -pninjaPA55word -e "create database ninja_cng"'
        #command: bash -c "mysql -u root -p'ninjaPA55w0rd' -e 'create database ninja_cng'"
        networks:
            - truebits-invoice-ninja-cng

networks:
    truebits-invoice-ninja-cng:
