FROM python:3.12-slim

WORKDIR /app

# Install system dependencies for pdfplumber and psycopg2
RUN apt-get update && apt-get install -y --no-install-recommends \
    gcc \
    libpq-dev \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt

COPY . .

# Create patents directory for PDF storage
RUN mkdir -p /app/patents

# Expose ports for API and Dashboard
EXPOSE 8000 8501

# Default command runs the API (can be overridden in docker-compose)
CMD ["uvicorn", "SPARC.api:app", "--host", "0.0.0.0", "--port", "8000"]

