services:
  # Serviço PHP-FPM com Laravel
  php:
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - ./:/var/www/html
      # Volume para sobrescrever o php.ini, se necessário
      # - ./docker/php/php.ini:/usr/local/etc/php/php.ini
    networks:
      - laravel-network
    restart: unless-stopped
    depends_on:
      - mysql

  # Serviço Nginx para servir a aplicação
  nginx:
    image: nginx:latest
    ports:
      - "80:80"
    volumes:
      - ./:/var/www/html
      - ./docker/nginx.conf:/etc/nginx/conf.d/default.conf
    networks:
      - laravel-network
    restart: unless-stopped
    depends_on:
      - php

  # Serviço MySQL para o banco de dados
  mysql:
    image: mysql:8.0
    ports:
      - "33069:3306"
    environment:
      MYSQL_DATABASE: laravel
      MYSQL_ROOT_PASSWORD: root_password
      MYSQL_USER: laravel_user
      MYSQL_PASSWORD: laravel_password
    volumes:
      - mysql-data:/var/lib/mysql
    networks:
      - laravel-network
    restart: unless-stopped

# Volumes
volumes:
  mysql-data:
    driver: local

# Networks
networks:
  laravel-network:
    driver: bridge
