Plaiglab / Dockerfile
SanidhyaDhangar's picture
PlaigLab β€” Hugging Face Space (Docker) clean deploy
ebebfe8
Raw
History Blame Contribute Delete
1.38 kB
# PlaigLab β€” Hugging Face Spaces (Docker SDK) image.
# Always-on container: long-running investigations, background threads and the
# in-memory job table all work as written. Listens on 0.0.0.0:7860 (HF routes
# external traffic to that port).
FROM python:3.11-slim
# System libs some wheels expect at runtime (pymupdf, onnxruntime, numpy).
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# HF Spaces run as uid 1000; give that user a writable home + app dir.
RUN useradd -m -u 1000 user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
HOST=0.0.0.0 \
PORT=7860 \
PYTHONUNBUFFERED=1
WORKDIR /home/user/app
# Install Python deps first so this layer caches across code changes.
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# Copy the project (respects .dockerignore).
COPY --chown=user . .
# Fetch the Phase-A model stack (MiniLM + GPT-2/distilGPT-2 ONNX, ~250MB) at
# build time so the semantic + Binoculars AI ensemble is live on first request.
# Build still succeeds if a download hiccups β€” the app degrades to lexical mode.
RUN python scripts/get_models.py || echo "model fetch incomplete; running in lite mode"
USER user
EXPOSE 7860
CMD ["python", "webapp/server.py"]