RAMESH143code's picture
Upload 12 files
4d8a2c2 verified
# Dockerfile for Vectorless RAG - Hugging Face Spaces Deployment
# Use Python 3.11 slim image for smaller size
FROM python:3.11-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# Install system dependencies for PDF processing and OCR
RUN apt-get update && apt-get install -y \
# PDF processing dependencies
poppler-utils \
libmagic1 \
# OCR dependencies
tesseract-ocr \
tesseract-ocr-eng \
tesseract-ocr-hin \
tesseract-ocr-fra \
tesseract-ocr-deu \
tesseract-ocr-spa \
# Build tools (if needed for some packages)
gcc \
g++ \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user for security
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# Set working directory
WORKDIR /app
# Copy requirements first for better caching
COPY --chown=user ./requirements.txt /app/requirements.txt
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy the entire application
COPY --chown=user . /app
# Create necessary directories
RUN mkdir -p /app/data /app/evaluation_data /app/frontend
# Expose the port (Hugging Face Spaces requires port 7860)
EXPOSE 7860
# Health check (optional but recommended)
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
# Run the application
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]