-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.demo
More file actions
54 lines (43 loc) · 1.79 KB
/
Copy pathDockerfile.demo
File metadata and controls
54 lines (43 loc) · 1.79 KB
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
49
50
51
52
53
54
# =============================================================================
# PGVectorRAGIndexer — Demo Instance Dockerfile
# =============================================================================
#
# Builds a read-only demo image with sample corpus pre-indexed.
# Used for the hosted "Try it now" demo at demo.pgvectorrag.com (or similar).
#
# Usage:
# docker build -f Dockerfile.demo -t pgvectorrag-demo .
# docker compose -f docker-compose.demo.yml up -d
#
# Environment:
# DEMO_MODE=1 is set automatically — all write operations are blocked.
# =============================================================================
FROM python:3.12-slim
WORKDIR /app
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
# Python dependencies — install CPU-only PyTorch first to avoid the
# full CUDA-enabled torch (~2GB install, ~400MB+ RAM). CPU-only is
# ~200MB and fits within Render free tier's 512MB RAM limit.
COPY requirements.txt .
RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu \
&& pip install --no-cache-dir -r requirements.txt
# Application code
COPY . .
# Sample corpus for demo (create if not present)
RUN mkdir -p /app/demo-corpus
# Pre-download embedding model so it's cached in the image
# (avoids slow download at runtime on free-tier hosts)
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
# Demo mode environment
ENV DEMO_MODE=1
ENV PYTHONUNBUFFERED=1
# Health check
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD curl -f http://localhost:10000/health || exit 1
EXPOSE 10000
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "10000"]