services:
  # PHP-FPM service for Symfony
  php:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: symfony_php
    volumes:
      - .:/var/www/symfony  # Your Symfony project directory
    networks:
      - symfony_net
    environment:
      - SYMFONY_ENV=dev
    ports:
      - "8000:8000"
    command: symfony server:start --no-tls --allow-http --port=8000 --allow-all-ip

  # MySQL 8.3 community edition
  mysql:
    image: mysql:8.3
    container_name: symfony_mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: root_password
      MYSQL_DATABASE: symfony_db
      MYSQL_USER: symfony_user
      MYSQL_PASSWORD: symfony_password
    volumes:
      - mysql_data:/var/lib/mysql
    networks:
      - symfony_net
    ports:
      - "3306:3306"

  # Optionally, you can add a web server like Nginx here
  # nginx:
  #   image: nginx:latest
  #   container_name: symfony_nginx
  #   volumes:
  #     - ./symfony:/var/www/symfony
  #     - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
  #   ports:
  #     - "80:80"
  #   networks:
  #     - symfony_net

volumes:
  mysql_data:
    driver: local

networks:
  symfony_net:
    driver: bridge
