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
        networks: [appnet]
    colibriplus:
        build:
            context: .
            dockerfile: docker/colibriplus/Dockerfile
            target: php-web
        volumes:
            - './:/var/www/html'
        stdin_open: true
        tty: true
        expose:
            - '9000'
        container_name: colibriplus-app
        depends_on:
            - database
        networks: [appnet]
    database:
        image: mysql
        restart: always
        volumes:
            - './docker/database/mysql/data:/var/lib/mysql'
        ports:
            - '3307:3306'
        environment:
            - MYSQL_ROOT_PASSWORD=99099
            - MYSQL_DATABASE=colibri_plus
        container_name: colibriplus-db
        networks: [appnet]
    node:
        image: 'node:20'
        working_dir: /var/www/html
        volumes:
            - './:/var/www/html'
        container_name: colibriplus-node
        command: 'sh -c "npm run dev"'
        ports:
            - '5173:5173'
        depends_on:
            - colibriplus
    reverb:
        build:
            context: .
            dockerfile: docker/colibriplus/Dockerfile
            target: php-runtime
        stdin_open: true
        tty: true
        volumes:
            - './:/var/www/html'
        depends_on:
            - colibriplus
        command: 'php artisan reverb:start'
        container_name: colibriplus-reverb
        networks: [appnet]
    horizon:
        build:
            context: .
            dockerfile: docker/colibriplus/Dockerfile
            target: php-web
        volumes:
            - './:/var/www/html'
        depends_on:
            - redis
        command: 'php artisan horizon'
        container_name: colibriplus-horizon
        networks: [appnet]
    redis:
        image: 'redis:latest'
        container_name: colibriplus-redis
        ports:
            - '6390:6379'
        networks: [appnet]
volumes:
    sail-mysql:
        driver: local

networks:
    appnet:
        driver: bridge
    sail:
        driver: bridge
