# Benchmark-only image for the FastAPI wrapper in brinicle/ref (not the
# published server). It copies the host-built extension
# (brinicle/_brinicle*.so, from build.sh), so build that first, then from the
# repo root:
#   docker build -f brinicle/ref/Dockerfile -t brinicle-ref .

FROM python:3.14-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
        libgomp1 \
        libstdc++6 \
        curl \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

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

ENV PYTHONPATH="/app"

COPY brinicle/ ./brinicle/

RUN mkdir -p ./app/data/indices

ENV PYTHONPATH="${PYTHONPATH}:/app"

EXPOSE 1984

HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
    CMD curl -fs http://localhost:1984/ || exit 1

# run the FastAPI application. workers must be one
CMD ["uvicorn", "brinicle.ref.api:app", "--host", "0.0.0.0", "--port", "1984", "--no-access-log", "--workers", "1"]
# CMD ["uvicorn", "brinicle.ref.item_search_api:app", "--host", "0.0.0.0", "--port", "1984", "--no-access-log", "--workers", "1"]

# ----------------------------------
