version: "3.7"

services:
    # image project
    app:
        build:
            context: .
            dockerfile: Dockerfile
        # image: docker/laravel9-app
        restart: unless-stopped
        working_dir: /var/www/
        volumes:
            - ./:/var/www
        depends_on:
            - redis
        networks:
            - laravel-9

    # nginx
    nginx:
        image: nginx:alpine
        restart: unless-stopped
        ports: 
            - "80:80"
        volumes: 
            - ./:/var/www
            - ./docker/nginx/:/etc/nginx/conf.d/
        networks: 
            - laravel-9

    # db mysql
    mysql:
        image: mysql:5.7.22
        restart: unless-stopped
        environment:
            MYSQL_DATABASE: ${DB_DATABASE}
            MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
            MYSQL_PASSWORD: ${DB_PASSWORD}
            MYSQL_USER: ${DB_USERNAME}
        volumes:
            - ./.docker/mysql/dbdata:/var/lib/mysql
        ports:
            - "3388:3306"
        networks:
            - laravel-9

    # queue
    queue:
        image: especializati/laravel9-app
        restart: unless-stopped
        command: "php artisan queue:work"
        volumes:
            - ./:/var/www
        depends_on:
            - redis
            - app
        networks:
            - laravel-9

    # redis
    redis:
        image: redis:latest
        networks:
            - laravel-9

networks:
    laravel-9:
        driver: bridge
