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

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

    # db mysql
    db:
        image: mysql:5.7.44
        platform: linux/x86_64
        restart: unless-stopped
        environment:
            MYSQL_DATABASE: ${DB_DATABASE:-laravel}
            MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-root}
            MYSQL_PASSWORD: ${DB_PASSWORD:-userpass}
            MYSQL_USER: ${DB_USERNAME:-username}
        volumes:
            - ./.docker/mysql/dbdata:/var/lib/mysql
        ports:
            - "3300:3306"
        networks:
            - laravel

    # PHPMyAdmin
    phpmyadmin:
        image: phpmyadmin/phpmyadmin
        platform: linux/x86_64
        restart: unless-stopped
        ports:
            - "8080:80"
        environment:
            PMA_HOST: db
            PMA_PORT: 3306
            MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-root}
        networks:
            - laravel

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

networks:
    laravel:
        driver: bridge
