QueryLensV2b / Dockerfile
Aniruddha7's picture
Full deploy of QueryLensV2 (code + demo db) to a fresh Space
19dfd32 verified
Raw History Blame Contribute Delete
1.26 kB
# ☁️ Dockerfile for Hugging Face Spaces — Cloud-Only (Lightweight)
# Image size: ~500MB (no Ollama, no local models)
# All LLM inference is handled by Groq API and HF Inference API via USE_HF_CLOUD=1
FROM python:3.11-slim
# Prevent Python from writing pyc files and buffering stdout/stderr
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Cloud mode: all LLM calls go to Groq / HF Inference — no local Ollama needed
ENV USE_HF_CLOUD=1
# Install system dependencies (Tesseract for OCR fallback only)
RUN apt-get update && apt-get install -y \
curl \
zstd \
tesseract-ocr \
libtesseract-dev \
gcc \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt && \
pip install --no-cache-dir llama-index-llms-huggingface-api huggingface_hub
# Copy application code
COPY . .
# Hugging Face Spaces requires port 7860
EXPOSE 7860
# Fix line endings and permissions on startup script
RUN sed -i 's/\r$//' start_hf.sh && chmod +x start_hf.sh
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app 2>/dev/null || true
USER appuser
CMD ["./start_hf.sh"]