# ============================================================================= # Docker Compose Configuration for RAG System # ============================================================================= # This file defines the services and configuration for running the RAG system # in a containerized environment using Docker Compose. # ============================================================================= # COMPOSE VERSION # ============================================================================= # Specify Docker Compose file format version # Version 3.8 provides modern features and compatibility version: '3.8' # ============================================================================= # SERVICES DEFINITION # ============================================================================= services: # ============================================================================= # RAG SYSTEM SERVICE # ============================================================================= # Main service for the RAG system application rag-system: # Build the Docker image from the current directory # Uses the Dockerfile in the root directory build: . # ============================================================================= # NETWORK CONFIGURATION # ============================================================================= # Port mapping: host_port:container_port # Maps port 8501 from the host to port 8501 in the container # Allows access to the Streamlit web interface from the host machine ports: - "8501:8501" # ============================================================================= # ENVIRONMENT VARIABLES # ============================================================================= # Set environment variables for the container # These override the defaults set in the Dockerfile environment: # Python path configuration - PYTHONPATH=/app # Streamlit server configuration - STREAMLIT_SERVER_PORT=8501 - STREAMLIT_SERVER_ADDRESS=0.0.0.0 - STREAMLIT_SERVER_HEADLESS=true # ============================================================================= # VOLUME MOUNTING # ============================================================================= # Mount volumes for data persistence # This ensures that the vector store data persists between container restarts volumes: # Mount the local vector_store directory to the container # Format: host_path:container_path - ./vector_store:/app/vector_store # ============================================================================= # RESTART POLICY # ============================================================================= # Container restart policy # unless-stopped: Restart the container unless it was explicitly stopped # This ensures the service stays running even after system reboots restart: unless-stopped # ============================================================================= # HEALTH CHECK CONFIGURATION # ============================================================================= # Health check to monitor service status healthcheck: # Command to test if the service is healthy # Uses curl to check if the Streamlit health endpoint responds test: ["CMD", "curl", "-f", "http://localhost:8501/_stcore/health"] # Check interval: run health check every 30 seconds interval: 30s # Timeout: wait up to 10 seconds for health check to complete timeout: 10s # Retries: attempt health check 3 times before marking as unhealthy retries: 3