services:
  php:
    build:
      context: .
      dockerfile: docker/php/Dockerfile
    container_name: symfony_php
    volumes:
      - .:/var/www/symfony
    working_dir: /var/www/symfony
    depends_on:
      - mysql

  nginx:
    image: nginx:stable-alpine
    container_name: symfony_nginx
    ports:
      - "8080:80"
    volumes:
      - .:/var/www/symfony
      - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro  #:ro for read-only
    depends_on:
      - php

  mysql:
    image: mysql:8.0
    container_name: symfony_mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: symfony
      MYSQL_USER: symfony
      MYSQL_PASSWORD: symfony
    ports:
      - "3306:3306"
    volumes:
      - mysql_data:/var/lib/mysql

volumes:
  mysql_data:
