FROM python:3.11-slim

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    gcc \
    curl \
    ripgrep \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements and install Python dependencies first (for better caching)
COPY services/rao/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy only the necessary project files
COPY models.config.json ./models.config.json
COPY services/rao/ ./services/rao/
COPY services/mcp/ ./services/mcp/
COPY tools/ ./tools/
COPY api/ ./api/
COPY data/ ./data/
COPY model_types/ ./model_types/

# Create logs directory
RUN mkdir -p /app/logs

# Expose port
EXPOSE 8000

# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
    CMD curl -f http://localhost:8000/health || exit 1

# Run the application
CMD ["python", "services/rao/main.py"] 
