version: '3.7'
services:
  ydo_nginx:
    build: ./docker/nginx
    container_name: ydo_nginx
    ports:
      - "81:80"
    volumes:
      - ./docker/nginx/conf:/etc/nginx/conf.d
      - .:/var/www/html
      - ./docker/nginx/log/:/var/log/nginx
      - /tmp:/tmp
    depends_on:
      - ydo_php
    networks:
      - ydo-net

  ydo_php:
    build: ./docker/php
    container_name: ydo_php
    ports:
      - "8086:80"
    volumes:
      - .:/var/www/html
      - /tmp:/tmp
      - ~/.composer:/var/www/.composer
    environment:
      - "DB_PORT=3306"
      - "DB_HOST=ydo_mysql"
    depends_on:
      - ydo_mysql
    networks:
      - ydo-net

  ydo_mysql:
    image: library/mysql:8.0.20
    container_name: ydo_mysql
    command: --default-authentication-plugin=mysql_native_password
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ROOT_PASSWORD=123
      - MYSQL_DATABASE=yourdaysout
      - MYSQL_USER=root
      - MYSQL_PASSWORD=root
    volumes:
      - ./docker/mysql:/etc/mysql/conf.d
      - ydo_mysql_data:/var/lib/mysql
    networks:
      - ydo-net

  ydo_pma:
    image: phpmyadmin/phpmyadmin
    container_name: ydo_pma
    environment:
      - PMA_ARBITRARY=1
    restart: always
    ports:
      - "89:80"
    volumes:
      - /sessions
      - ./docker/pma/upload.ini:/usr/local/etc/php/php.ini
    networks:
      - ydo-net

networks:
  ydo-net:
volumes:
  ydo_mysql_data:
