# For more information: https://laravel.com/docs/sail
version: '3'
services:
    laravel:
        build:
            context: ./vendor/laravel/sail/runtimes/8.2
            dockerfile: Dockerfile
            args:
                WWWGROUP: '${WWWGROUP}'
        image: sail-8.3/app
        extra_hosts:
            - 'host.docker.internal:host-gateway'
        ports:
            - '${APP_PORT:-80}:80'
            - 5173:5173
        environment:
            WWWUSER: '${WWWUSER}'
            LARAVEL_SAIL: 1
            XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
            XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
        volumes:
            - '.:/var/www/html'
            - './docker/php.ini:/etc/php/8.1/cli/conf.d/99-sail.ini'
        networks:
            - laravel-coreui
        depends_on:
            - mysql
            # - redis
    mysql:
        image: bitnami/mysql:8.0.23
        ports:
            - '${FORWARD_DB_PORT:-3306}:3306'
        environment:
            MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
            MYSQL_ROOT_HOST: "%"
            MYSQL_DATABASE: '${DB_DATABASE}'
            MYSQL_USER: '${DB_USERNAME}'
            MYSQL_PASSWORD: '${DB_PASSWORD}'
            MYSQL_ALLOW_EMPTY_PASSWORD: 1
            ALLOW_EMPTY_PASSWORD: 'yes'
            MYSQL_AUTHENTICATION_PLUGIN: 'mysql_native_password'
        volumes:
            - "./docker/my.cnf:/etc/mysql/my.cnf"
            - 'laravel-mysql:/var/lib/mysql'
        networks:
            - laravel-coreui
    # redis:
    #     image: 'redis:alpine'
    #     ports:
    #         - '${FORWARD_REDIS_PORT:-6379}:6379'
    #     volumes:
    #         - 'laravel-redis:/data'
    #     networks:
    #         - laravel-coreui
networks:
    laravel-coreui:
        driver: bridge
volumes:
    laravel-mysql:
        driver: local
    laravel-redis:
        driver: local
