qwe / Dockerfile
Rajhuggingface4253's picture
Rename dockerfile to Dockerfile
d4e6402 verified
raw
history blame contribute delete
968 Bytes
FROM python:3.10-slim-bookworm
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV HF_HUB_ENABLE_HF_TRANSFER=1
ENV HF_HOME=/app/cache
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
build-essential \
python3-dev \
libxml2-dev \
libxslt1-dev \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Create and permission the cache directory
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
# Copy the requirements and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the application code and RAG engine
COPY app.py .
COPY rag_engine.py .
# Build RAG index (ingest URLs once during build)
RUN python rag_engine.py
# Expose the default port for Hugging Face Spaces
EXPOSE 7860
# Command to run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]