services:

    db:
        image: mysql
        command: mysqld --sql_mode="" --default-authentication-plugin=mysql_native_password
        container_name: db_driving
        restart: always
        env_file:
            - .env.docker
        volumes:
            - ./docker/db-data:/var/lib/mysql
        environment:
            MYSQL_ROOT_PASSWORD: '${MYSQL_ROOT_PASSWORD}'
            MYSQL_DATABASE: '${MYSQL_DATABASE}'
            MYSQL_USER: '${MYSQL_USER}'
            MYSQL_PASSWORD: '${MYSQL_PASSWORD}'
        ports:
            - "3309:3306"

    phpmyadmin:
        image: phpmyadmin
        container_name: phpmyadmin_driving
        restart: always
        depends_on:
            - db
        ports:
            - "82:80"
        env_file:
            - .env.docker
        volumes:
            - ./docker/db-data:/var/lib/mysql
        environment:
            PMA_HOST: db
            MYSQL_ROOT_PASSWORD: '${MYSQL_ROOT_PASSWORD}'
            MYSQL_USER: '${MYSQL_USER}'
            MYSQL_PASSWORD: '${MYSQL_PASSWORD}'
            UPLOAD_LIMIT: 200M

    www:
        build: ./docker/php
        container_name: www_driving
        #command: ["sh", "-c" , "chmod -R 777 var/cache && chmod -R 777 var/log && apache2-foreground"]
        ports:
            - "81:80"
        volumes:
            - ./docker/php/vhosts:/etc/apache2/sites-enabled
            - ./docker/php/php.ini:/usr/local/etc/php/conf.d/php.ini
            - ./:/var/www

