kumarakkiy's picture
Discourse filter, exact-phrase search, ANN index (v2 dataset rev pinned)
75d531a verified
Raw
History Blame Contribute Delete
1.54 kB
# Slim online SearchAudio image (CPU only). Build context = project root:
# docker build -f deploy/Dockerfile -t searchaudio-online .
FROM python:3.11-slim
WORKDIR /app
ENV HF_HOME=/app/models \
HF_HUB_CACHE=/app/models/hub \
SEARCHAUDIO_AUDIO_MODE=archive \
PYTHONUNBUFFERED=1
COPY requirements-online.txt .
RUN pip install --no-cache-dir -r requirements-online.txt
# Bake bge-m3 into the image so cold starts don't download it.
RUN python -c "from FlagEmbedding import BGEM3FlagModel; BGEM3FlagModel('BAAI/bge-m3', use_fp16=False)"
# Pull the index from its own dataset repo rather than the Space repo: free Spaces cap
# repo storage at 1 GB and the index is already 1.5 GB, growing with every ingest run.
# Baked in at build time, so cold starts don't pay for it. Must precede HF_HUB_OFFLINE.
# INDEX_REV pins the dataset commit — bump it on every index update, both for
# reproducible builds and to bust Docker's layer cache (an unchanged RUN line would
# silently reuse the previously downloaded index).
ARG INDEX_REPO=kumarakkiy/osho-discourse-index
ARG INDEX_REV=42e6dd0e998a9f76d1c4d73d6e604108e48385e9
RUN python -c "from huggingface_hub import snapshot_download; snapshot_download('$INDEX_REPO', repo_type='dataset', revision='$INDEX_REV', local_dir='/app/data/index')"
# Everything past here runs with no network reads from the Hub.
ENV HF_HUB_OFFLINE=1
COPY app ./app
COPY config.yaml ./config.yaml
EXPOSE 7860
CMD ["uvicorn", "app.server:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]