Spaces:
Running
Running
File size: 1,513 Bytes
634117a a465955 634117a a465955 634117a a465955 634117a a465955 634117a a465955 634117a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | # Kerdos AI — Custom LLM Chat (Demo)
# Multi-stage Docker build — supports both Gradio UI and FastAPI REST server
#
# Build for Gradio (default):
# docker build -t kerdos-rag .
# docker run -p 7860:7860 -e HF_TOKEN=hf_... kerdos-rag
#
# Build for REST API:
# docker build --build-arg MODE=api -t kerdos-rag-api .
# docker run -p 8000:8000 -e HF_TOKEN=hf_... kerdos-rag-api
ARG MODE=serve
FROM python:3.11-slim AS base
# System dependencies for PyMuPDF and FAISS
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install Python dependencies first (layer-cached)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy source
COPY . .
# Install the package in editable mode so kerdos-rag CLI is available
RUN pip install --no-cache-dir -e .
# ── Gradio mode ───────────────────────────────────────────────
FROM base AS serve
EXPOSE 7860
ENV GRADIO_SERVER_NAME=0.0.0.0
ENV GRADIO_SERVER_PORT=7860
CMD ["kerdos-rag", "serve", "--host", "0.0.0.0", "--port", "7860"]
# ── FastAPI REST mode ─────────────────────────────────────────
FROM base AS api
EXPOSE 8000
CMD ["kerdos-rag", "api", "--host", "0.0.0.0", "--port", "8000"]
# Select the right stage based on BUILD ARG
FROM ${MODE}
|