version: '3.8'
services:

    app:
        build:
            context: .
            dockerfile: Dockerfile
        container_name: app
        restart: unless-stopped
        tty: true
        working_dir: /var/www
        volumes:
            - laravel-storage:/var/www/storage
            - ./docker/app/php/local.ini:/usr/local/etc/php/conf.d/local.ini
        networks:
            - app-network
        depends_on:
            - db
    webserver:
        image: nginx:alpine
        container_name: webserver
        restart: unless-stopped
        tty: true
        ports:
            - "80:80"
            - "443:443"
        volumes:
            - ./:/var/www
            - ./docker/webserver/nginx/conf.d/:/etc/nginx/conf.d/
        networks:
            - app-network
        depends_on:
            - app

    db:
        image: mysql:8
        container_name: db
        restart: unless-stopped
        tty: true
        ports:
            - "3306:3306"
        environment:
            MYSQL_RANDOM_ROOT_PASSWORD: true
            MYSQL_DATABASE: ${DB_DATABASE}
            MYSQL_USER: ${DB_USERNAME}
            MYSQL_PASSWORD: ${DB_PASSWORD}
            SERVICE_TAGS: dev
            SERVICE_NAME: mysql
        volumes:
            - db-data:/var/lib/mysql
            - ./docker/db/mysql/conf.d:/etc/mysql/conf.d
        networks:
            - app-network

networks:
    app-network:
        driver: bridge
volumes:
    db-data:
        driver: local
    laravel-storage:
        driver: local

version: '3.8'
services:

    app:
        build:
            context: .
            dockerfile: Dockerfile
        container_name: app
        restart: unless-stopped
        tty: true
        working_dir: /var/www
        volumes:
            - laravel-storage:/var/www/storage
            - ./docker/app/php/local.ini:/usr/local/etc/php/conf.d/local.ini
        networks:
            - app-network
        depends_on:
            - db
    webserver:
        image: nginx:alpine
        container_name: webserver
        restart: unless-stopped
        tty: true
        ports:
            - "80:80"
            - "443:443"
        volumes:
            - ./:/var/www
            - ./docker/webserver/nginx/conf.d/:/etc/nginx/conf.d/
        networks:
            - app-network
        depends_on:
            - app

    db:
        image: mysql:8
        container_name: db
        restart: unless-stopped
        tty: true
        ports:
            - "3306:3306"
        environment:
            MYSQL_RANDOM_ROOT_PASSWORD: "yes"
            MYSQL_DATABASE: ${DB_DATABASE}
            MYSQL_USER: ${DB_USERNAME}
            MYSQL_PASSWORD: ${DB_PASSWORD}
            SERVICE_TAGS: dev
            SERVICE_NAME: mysql
        volumes:
            - db-data:/var/lib/mysql
            - ./docker/db/mysql/conf.d:/etc/mysql/conf.d
        networks:
            - app-network

networks:
    app-network:
        driver: bridge
volumes:
    db-data:
        driver: local
    laravel-storage:
        driver: local

Fix invalid value for enabling random MySQL root password
Fix invalid value for enabling random MySQL root password
