FROM python:3.12-slim

WORKDIR /app

ARG APP_VERSION=dev

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    MPLBACKEND=Agg \
    PYTHONPATH=/app \
    SERVICE_PORT=7475 \
    APP_VERSION=${APP_VERSION}

LABEL org.opencontainers.image.title="srv-seq-interp" \
      org.opencontainers.image.version="${APP_VERSION}"

RUN apt-get update && apt-get install -y --no-install-recommends \
    libgomp1 tk \
    && rm -rf /var/lib/apt/lists/*

# Build context is the monorepo root (docker-compose context: .)
COPY services/seq-interp/requirements.docker.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt

COPY libs/lf-scanner /app/LF_scanner
RUN pip install --no-cache-dir /app/LF_scanner

COPY services/seq-interp /app/seq_interp

WORKDIR /app/seq_interp

EXPOSE 7475

CMD ["sh", "-c", "uvicorn api:app --host 0.0.0.0 --port ${SERVICE_PORT}"]
