version: '2'
services:
  mysql:
    image: mysql:latest
    volumes:
      - "./data/db:/var/lib/mysql"
    ports:
      - "3306:3306"
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=secret
      - MYSQL_DATABASE=laravel_boilerplate
      - MYSQL_USER=root
      - MYSQL_PASSWORD=secret
  laravel-env:
    build: ./dockerfiles
    depends_on:
      - mysql
    volumes:
      - ".:/var/www/laravel-boilerplate"
      - "./dockerfiles/config/php/php-fpm.conf:/etc/php-fpm.conf"
      - "./dockerfiles/config/php/www.conf:/etc/php-fpm.d/www.conf"
      - "./dockerfiles/config/php/php.ini:/usr/local/etc/php/php.ini"
      - "./dockerfiles/config/php/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini"
  nginx:
    image: nginx:latest
    depends_on:
      - laravel-env
    volumes:
      - ".:/var/www/laravel-boilerplate"
      - "./dockerfiles/config/nginx/default.conf:/etc/nginx/conf.d/default.conf"
    ports:
      - "80:80"
    restart: always
