FROM python:3.13-slim

WORKDIR /app

# Install uv for fast, reproducible installs
RUN pip install --no-cache-dir uv alembic

# Install Python dependencies from pyproject.toml
COPY pyproject.toml .
RUN uv pip install --system --no-cache .

# Download spaCy language models
RUN python -m spacy download en_core_web_sm && \
    python -m spacy download fr_core_news_sm && \
    python -m spacy download es_core_news_sm && \
    python -m spacy download it_core_news_sm && \
    python -m spacy download de_core_news_sm

# Copy application source and migrations
COPY app/ ./app/
COPY alembic/ ./alembic/
COPY alembic.ini .

EXPOSE 8000
CMD ["sh", "-c", "alembic upgrade head && uvicorn app.main:app --host 0.0.0.0 --port 8000"]
