version: '3'

services:
    nginx:
        image: nginx:latest
        volumes:
            - ./:/var/www/
            - ./_docker/nginx/conf.d/:/etc/nginx/conf.d/
        ports:
            - "8070:80"
        depends_on:
            - app
        container_name: cahul-nginx

    app:
        build:
            context: .
            dockerfile: _docker/app/Dockerfile
        volumes:
            - ./:/var/www/
        depends_on:
            - db
        container_name: cahul-app

    db:
        image: mysql:latest
        restart: always
        volumes:
            - mysql_data:/var/lib/mysql
        environment:
            MYSQL_DATABASE: cahul
            MYSQL_ROOT_PASSWORD: root
        ports:
            - 8071:3306
        command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
        container_name: cahul-db

    phpmyadmin:
        image: phpmyadmin
        restart: always
        ports:
            - 8072:80
        environment:
            - PMA_ARBITRARY=1
volumes:
    mysql_data:
