services:
  sophena:
    build:
      dockerfile: .
    container_name: sophena
    ports:
      - "8081:8081"
    volumes:
      # Mount database and images directory
      - ./data/cache.db:/mnt/okcomputer/output/cache.db
      - ./data/images:/mnt/okcomputer/output/images
      # Mount YOLO models (optional)
      - ./models:/app/models:ro
    environment:
      # Database configuration
      - AUCTION_DATABASE_PATH=/mnt/okcomputer/output/cache.db
      - AUCTION_IMAGES_PATH=/mnt/okcomputer/output/images

      # Notification configuration
      # Use 'desktop' for desktop notifications or SMTP config for email
      - AUCTION_NOTIFICATION_CONFIG=desktop
      # For email: smtp:your@gmail.com:app_password:recipient@example.com

      # YOLO model paths (optional - works without object detection)
      - AUCTION_YOLO_CONFIG=/app/models/yolov4.cfg
      - AUCTION_YOLO_WEIGHTS=/app/models/yolov4.weights
      - AUCTION_YOLO_CLASSES=/app/models/coco.names

      # Quarkus configuration
      - QUARKUS_HTTP_PORT=8081
      - QUARKUS_HTTP_HOST=0.0.0.0
      - QUARKUS_LOG_CONSOLE_LEVEL=INFO

      # Scheduler configuration (cron expressions)
      - AUCTION_WORKFLOW_SCRAPER_IMPORT_CRON=0 */30 * * * ?
      - AUCTION_WORKFLOW_IMAGE_PROCESSING_CRON=0 0 * * * ?
      - AUCTION_WORKFLOW_BID_MONITORING_CRON=0 */15 * * * ?
      - AUCTION_WORKFLOW_CLOSING_ALERTS_CRON=0 */5 * * * ?
      - JAVA_TOOL_OPTIONS=-Dio.netty.tryReflectionSetAccessible=true --enable-native-access=ALL-UNNAMED --sun-misc-unsafe-memory-access=allow

    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8081/health/live"]
      interval: 30s
      timeout: 3s
      retries: 3
      start_period: 10s

    restart: unless-stopped

    networks:
      - auction-network


networks:
  auction-network:
    driver: bridge

volumes:
  auction-data:
    driver: local
