RAG_SPACE / Dockerfile
NimrodDev's picture
cmc
f56ceca
# ---------- Base ----------
FROM python:3.11-slim
# ---------- Environment Setup ----------
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV HF_HOME=/code/.cache/huggingface
ENV TRANSFORMERS_CACHE=/code/.cache/huggingface
ENV TORCH_HOME=/code/.cache/torch
# ---------- System Dependencies ----------
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
wget \
&& rm -rf /var/lib/apt/lists/*
# ---------- Working Directory ----------
WORKDIR /code
# ---------- Install Python Dependencies ----------
COPY requirements.txt .
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
# ---------- Pre-Download Embedding Model ----------
COPY pre_download.py .
RUN python pre_download.py
# ---------- Copy Application Code ----------
COPY . .
# ---------- Ensure FAISS and Cache Dirs Exist ----------
RUN mkdir -p /code/faiss_db /code/.cache && chmod -R 777 /code/faiss_db /code/.cache
# ---------- Expose Web Port ----------
EXPOSE 7860
# ---------- Start the App ----------
CMD ["gunicorn", "app:app", "-b", "0.0.0.0:7860", "--timeout", "300"]