services:
    nginx:
        image: 'nginx:latest'
        restart: always
        ports:
            - '80:80'
        volumes:
            - './docker/nginx/conf.d/nginx.conf:/etc/nginx/conf.d/default.conf'
            - './public:/var/www/html/public'
            - './storage:/var/www/html/storage'
        depends_on:
            - colibriplus
        container_name: colibriplus-nginx
    colibriplus:
        build:
            context: .
            dockerfile: docker/colibriplus/Dockerfile
        volumes:
            - './:/var/www/html'
            - './docker/colibriplus/php.ini:/usr/local/etc/php/conf.d/colibriplus-php.ini'
            - './docker/colibriplus/opcache.ini:/usr/local/etc/php/conf.d/colibriplus-opcache.ini'
        stdin_open: true
        tty: true
        expose:
            - '9000'
        container_name: colibriplus-app
        depends_on:
            - database
    database:
        image: mysql
        restart: always
        volumes:
            - './docker/database/mysql/data:/var/lib/mysql'
        ports:
            - '3306:3306'
        environment:
            - MYSQL_ROOT_PASSWORD=admin
            - MYSQL_DATABASE=colibriplus
        container_name: colibriplus-db
    node:
        image: 'node:latest'
        working_dir: /var/www/html
        volumes:
            - './:/var/www/html'
        container_name: colibriplus-node
        command: 'sh -c "npm install && npm run build"'
        ports:
            - '5173:5173'
        depends_on:
            - colibriplus
    horizon:
        build:
            context: .
            dockerfile: docker/colibriplus/Dockerfile
        volumes:
            - './:/var/www/html'
        depends_on:
            - redis
        command: 'php artisan horizon'
        container_name: colibriplus-horizon
    redis:
        image: 'redis:latest'
        container_name: colibriplus-redis
        ports:
            - '6379:6379'
volumes:
    sail-mysql:
        driver: local

networks:
    sail:
        driver: bridge
