#!/bin/bash
set -e

echo "🏗️  Building RAG-Guard single container..."

# Build the Docker image with frontend and backend in one container
docker build -t rag-guard:latest -f Dockerfile .

echo "✅ Build complete!"
echo ""
echo "🚀 To run the container:"
echo "  # With mock responses (no API key needed):"
echo "  docker run -p 8000:8000 rag-guard:latest"
echo ""
echo "  # With OpenAI (replace with your API key):"
echo "  docker run -p 8000:8000 -e OPENAI_API_KEY=sk-your-key-here rag-guard:latest"
echo ""
echo "  # With custom OpenAI-compatible endpoint (e.g., local LLM):"
echo "  docker run -p 8000:8000 \\"
echo "    -e OPENAI_API_KEY=sk-your-key \\"
echo "    -e OPENAI_BASE_URL=http://localhost:1234/v1 \\"
echo "    -e OPENAI_MODEL=llama-3.2-3b-instruct \\"
echo "    rag-guard:latest"
echo ""
echo "📱 Then visit: http://localhost:8000"
echo ""
echo "🔍 The container includes:"
echo "  - FastAPI backend with real LLM integration (/chat, /health, /config)"
echo "  - Frontend SPA with client-side RAG pipeline"
echo "  - Local embedding model (all-MiniLM-L6-v2)"
echo "  - Everything runs on port 8000"
echo ""
echo "⚙️  Environment variables:"
echo "  OPENAI_API_KEY - Your OpenAI API key (required for real LLM)"
echo "  OPENAI_BASE_URL - API base URL (default: https://api.openai.com/v1)"
echo "  OPENAI_MODEL - Model name (default: gpt-4o-mini)"
