services:
  # ============================================
  # APPLICATION SERVICE
  # ============================================
  social-media-manager:
    build:
      context: ./social-media-manager
      dockerfile: Dockerfile
    image: social-media-manager:2.0.0-SNAPSHOT
    container_name: social-media-manager-app
    restart: unless-stopped
    network_mode: host
    environment:
      # Spring Profile
      - SPRING_PROFILES_ACTIVE=docker
      
      # Database Configuration
      - DATABASE_URL=jdbc:postgresql://162.240.175.216:5432/wwinst_social_media_manager_prd
      - DATABASE_USERNAME=wwinst_root
      - DATABASE_PASSWORD=Adorigram190120!
      
      # Server Configuration
      - SERVER_PORT=8000
      
      # Logging
      - LOG_LEVEL=INFO
      - SQL_LOG_LEVEL=WARN
      - LOG_FILE_PATH=/app/logs/social-media-manager.log
      
      # Social Media APIs (configure as needed)
      
      # JVM Options
      - JAVA_OPTS=-XX:+UseZGC -XX:+UseStringDeduplication -Xms512m -Xmx1024m
    volumes:
      - app_logs:/app/logs
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/actuator/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 60s
  
  # ============================================
  # FRONTEND SERVICE
  # ============================================
  hubber-dashboard:
    build:
      context: ./hubber-dashboard
      dockerfile: Dockerfile
    image: hubber-dashboard:1.0.0
    container_name: hubber-dashboard-app
    restart: unless-stopped
    network_mode: host
    environment:
      # Application Configuration
      - NODE_ENV=production
      - PORT=4000
      
      # API Configuration
      - API_BASE_URL=${API_BASE_URL:-http://localhost:8000}
      
      # Feature Flags
      - ENABLE_SSR=true
      - ENABLE_ANALYTICS=true
      
      # Security
      - SECURE_COOKIES=true
      - CORS_ORIGIN=${CORS_ORIGIN:-http://localhost:4000}
    volumes:
      # Optional: Mount logs volume
      - app_logs:/app/logs
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:4000"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 30s
    # Optional: Add resource limits
    deploy:
      resources:
        limits:
          memory: 512M
          cpus: '0.5'
        reservations:
          memory: 256M
          cpus: '0.25'
# ============================================
# VOLUMES
# ============================================
volumes:
  app_logs:
    driver: local
