Custom-LLM-Chat / Dockerfile
Bhaskar Ram
feat: Python package, FastAPI REST server, TypeScript SDK
634117a
# 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}