# Advanced WABA Panel — Docker Setup
# Usage: docker-compose up -d
# Then visit: http://localhost:8080/installer/

version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: waba-panel
    restart: unless-stopped
    ports:
      - "8080:80"
      - "8443:443"
    volumes:
      - ./:/var/www/html
      - ./storage:/var/www/html/storage
    environment:
      - APP_ENV=production
      - APP_DEBUG=false
      - DB_HOST=db
      - DB_DATABASE=waba_panel
      - DB_USERNAME=waba_user
      - DB_PASSWORD=waba_secret_2024
    depends_on:
      db:
        condition: service_healthy
    networks:
      - waba-network

  db:
    image: mysql:8.0
    container_name: waba-mysql
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: root_secret_2024
      MYSQL_DATABASE: waba_panel
      MYSQL_USER: waba_user
      MYSQL_PASSWORD: waba_secret_2024
    ports:
      - "3306:3306"
    volumes:
      - mysql_data:/var/lib/mysql
      - ./public/installer/schema.sql:/docker-entrypoint-initdb.d/01-schema.sql
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
      interval: 5s
      timeout: 5s
      retries: 5
    networks:
      - waba-network

  redis:
    image: redis:7-alpine
    container_name: waba-redis
    restart: unless-stopped
    ports:
      - "6379:6379"
    networks:
      - waba-network

volumes:
  mysql_data:

networks:
  waba-network:
    driver: bridge
