ReviewSearch / Dockerfile
yjoonjang's picture
deploy: update Space
d3caa3e verified
Raw
History Blame Contribute Delete
1.67 kB
# ReviewSearch — CPU hybrid search demo (Qdrant + FastAPI + React), single container.
FROM python:3.12-slim
RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# HF Spaces convention: run as non-root uid 1000 with a writable HOME.
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
WORKDIR /home/user/app
# CPU torch first (so downstream deps don't pull the CUDA build), then the rest.
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir torch==2.8.0 --index-url https://download.pytorch.org/whl/cpu
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Qdrant static (musl) binary — glibc-independent, matches the snapshot version (1.18.2).
RUN curl -sL https://github.com/qdrant/qdrant/releases/download/v1.18.2/qdrant-x86_64-unknown-linux-musl.tar.gz \
| tar xz -C /home/user/app && chmod +x /home/user/app/qdrant
COPY --chown=user reviewsearch ./reviewsearch
COPY --chown=user frontend ./frontend
COPY --chown=user start.sh ./start.sh
ENV PYTHONPATH=/home/user/app \
HF_HOME=/home/user/app/.cache/huggingface \
RS_DENSE_MODEL=yjoonjang/reviewsearch-dense \
RS_SPARSE_MODEL=yjoonjang/reviewsearch-sparse \
RS_DENSE_BACKEND=onnx \
RS_DENSE_ONNX_FILE=onnx/model_qint8_avx512_vnni.onnx \
RS_QDRANT_URL=http://localhost:6333 \
QDRANT__STORAGE__STORAGE_PATH=/home/user/app/qdrant_data/storage \
QDRANT__STORAGE__SNAPSHOTS_PATH=/home/user/app/qdrant_data/snapshots \
RS_THREADS=2 \
OMP_NUM_THREADS=2
EXPOSE 7860
CMD ["bash", "start.sh"]