version: '3.8'

services:
  app:
    image: bitnami/laravel:latest
    container_name: laravel_app
    environment:
      - ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}
      - LARAVEL_DATABASE_HOST=${DB_HOST}
      - LARAVEL_DATABASE_NAME=${DB_DATABASE}
      - LARAVEL_DATABASE_USER=${DB_USERNAME}
      - LARAVEL_DATABASE_PASSWORD=${DB_PASSWORD}
    volumes:
      - ./laravel:/app
    ports:
      - "8001:8000"
      - "5173:5173"
    depends_on:
      - mysql

  mysql:                                    
    image: mysql:latest
    container_name: laravel_mysql
    environment:
      - MYSQL_ROOT_PASSWORD=${DB_PASSWORD}
      - MYSQL_DATABASE=${DB_DATABASE}
      - MYSQL_USER=${DB_USERNAME}
      - MYSQL_PASSWORD=${DB_PASSWORD}  
      - MYSQL_ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}                                                                                                                                                          
    ports:
      - "${DB_PORT}:3306"
    volumes:
      - mysql_data:/var/lib/mysql

volumes:
  mysql_data:
