
services:
  # Serviço MySQL
  mysql:
    image: mysql:8.0
    container_name: sinagem_mysql
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: ${DB_DATABASE:-laravel}
      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-root}
      # MYSQL_PASSWORD: ${DB_PASSWORD:-root}
      # MYSQL_USER: ${DB_USERNAME:-laravel_user}
    ports:
      - "3307:3306"
    volumes:
      - mysql_data:/var/lib/mysql
    networks:
      - sinagem_network

  # Serviço phpMyAdmin
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: sinagem_phpmyadmin
    restart: unless-stopped
    environment:
      PMA_HOST: mysql
      PMA_PORT: 3306
      PMA_USER: ${DB_USERNAME:-root}
      PMA_PASSWORD: ${DB_PASSWORD:-root}
      UPLOAD_LIMIT: 100M
    ports:
      - "3000:80"
    depends_on:
      - mysql
    networks:
      - sinagem_network

  # Serviço PHP (Laravel)
  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: sinagem_app
    restart: unless-stopped
    ports:
      - "8000:8000"
    volumes:
      - ./:/var/www/html
    depends_on:
      - mysql
    networks:
      - sinagem_network

networks:
  sinagem_network:
    driver: bridge

volumes:
  mysql_data:
