version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "80:80"
    depends_on:
      - mysql
    networks:
      - app-network
    environment:
      - APP_URL=http://localhost
      - DB_CONNECTION=mysql
      - DB_HOST=mysql
      - DB_PORT=3306
      - DB_DATABASE=laravel
      - DB_USERNAME=laravel
      - DB_PASSWORD=laravel
      - MAIL_MAILER=smtp
      - MAIL_HOST=your_smtp_host
      - MAIL_PORT=465
      - MAIL_USERNAME=your_smtp_username
      - MAIL_PASSWORD=your_smtp_password
      - MAIL_ENCRYPTION=ssl
      - MAIL_FROM_ADDRESS=your_email@example.com
      - MAIL_FROM_NAME=no-reply
      - AWS_ACCESS_KEY_ID=your_aws_access_key
      - AWS_SECRET_ACCESS_KEY=your_aws_secret_key
      - AWS_BUCKET=your_aws_bucket
      - AWS_DEFAULT_REGION=your_aws_region
      - GOOGLE_MAP_API_KEY=your_google_map_api_key
    volumes:
      - .:/var/www/html
      - storage:/var/www/html/storage

  mysql:
    image: mysql:8.0
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: laravel
      MYSQL_USER: laravel
      MYSQL_PASSWORD: laravel
    volumes:
      - mysql-data:/var/lib/mysql
      - ./mysql-custom.cnf:/etc/mysql/conf.d/custom.cnf
    networks:
      - app-network

  phpmyadmin:
    image: phpmyadmin:latest
    ports:
      - "8080:80"
    environment:
      PMA_HOST: mysql
      PMA_USER: laravel
      PMA_PASSWORD: laravel
    depends_on:
      - mysql
    networks:
      - app-network

  queue:
    image: php:8.3-fpm-alpine
    command: php /var/www/html/artisan queue:work --tries=3
    depends_on:
      - app
      - mysql
    volumes:
      - .:/var/www/html
      - storage:/var/www/html/storage
    networks:
      - app-network

volumes:
  mysql-data:
  storage:

networks:
  app-network:
    driver: bridge