FROM python:3.12-slim

WORKDIR /app

# Install dependencies
COPY pyproject.toml README.md ./
COPY src ./src

RUN pip install --no-cache-dir -e ".[api]"

# Download Spacy model during build
RUN python -m spacy download en_core_web_sm

# Expose port
EXPOSE 8000

# Copy entrypoint script
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh

# Run the API
ENV PYTHONPATH=/app/src
CMD ["/app/entrypoint.sh"]
