Download Dockerfile from MVPRM/clair: direct link, hf CLI and curl.
- Browser
- Download file 1.65 kB
-
https://huggingface.co/spaces/MVPRM/clair/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/MVPRM/clair/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/MVPRM/clair/resolve/main/Dockerfile
1.65 kB
| # CLAIR (Clause Intelligence and Retrieval) single-service image: FastAPI + the retrieval backend frozen by the dev evaluation. | |
| # The corpus index (and, for dense backends, the pinned model) is built at image | |
| # build time, so the container never downloads anything at runtime. | |
| FROM python:3.12-slim | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| PIP_DISABLE_PIP_VERSION_CHECK=1 | |
| WORKDIR /srv | |
| # Install dependencies first (cached layer). Dense extras only if a dense backend was selected. | |
| COPY requirements.txt requirements-dense.txt ./ | |
| COPY artifacts/selection.json artifacts/selection.json | |
| RUN pip install -r requirements.txt \ | |
| && if ! grep -q '"selected": "bm25"' artifacts/selection.json; then pip install -r requirements-dense.txt; fi | |
| COPY data/ data/ | |
| COPY app/ app/ | |
| COPY scripts/build_index.py scripts/build_index.py | |
| # Deterministic index build for the selected backend only (downloads the pinned model revision if dense). | |
| RUN python scripts/build_index.py --methods selected | |
| # Validated classifier artifact (optional; the API serves search without it). | |
| COPY artifacts/classifier.joblib artifacts/classifier.joblib | |
| ENV HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 | |
| # Hugging Face Spaces runs containers as UID 1000; the explicit UID keeps that consistent. | |
| RUN useradd --create-home --uid 1000 appuser && chown -R appuser /srv | |
| USER appuser | |
| EXPOSE 8000 | |
| HEALTHCHECK --interval=30s --timeout=5s --start-period=60s \ | |
| CMD python -c "import urllib.request,sys; sys.exit(urllib.request.urlopen('http://127.0.0.1:8000/ready').status != 200)" | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] | |