Skip to content

Run with Docker

Docker Compose runs the API together with Postgres (with pgvector), Qdrant and pgAdmin.

./run.sh docker

or by hand:

cp docker/env/.env.example.postgres docker/env/.env.postgres
cp docker/env/.env.example.app docker/env/.env.app
docker compose -f docker/docker-compose.yml up -d --build

Edit both env files first: see Installation, step 2. In docker/env/.env.app the hosts are the service names (postgres, qdrant), not localhost.

Before exposing the API beyond your machine, set AUTH_ENABLED=true and an ADMIN_API_KEY in docker/env/.env.app: see Authentication.

Use the published image

Instead of building the image, you can pull a ready-made one from the GitHub Container Registry. It is built for linux/amd64 and linux/arm64 (Apple silicon, Graviton, Raspberry Pi 5), with Python 3.12:

export PAGELORE_IMAGE=ghcr.io/saqrianoo/pagelore:latest
docker compose -f docker/docker-compose.yml pull fastapi
docker compose -f docker/docker-compose.yml up -d --no-build

--no-build makes compose use the pulled image. The env files are the same as for a local build.

There are two variants:

Image Local models Use it for
ghcr.io/saqrianoo/pagelore:latest sentence-transformers (PyTorch, CPU build) and FastEmbed The default setup: local embeddings and reranking
ghcr.io/saqrianoo/pagelore:latest-slim FastEmbed only (ONNX, no PyTorch) A much smaller image: EMBEDDING_PROVIDER=FASTEMBED, or a hosted or server provider

Both have the clients for the hosted and server providers (OpenAI, Anthropic, Ollama, Cohere, Voyage, Gemini, Mistral, Jina, Hugging Face, Bedrock, rerank servers), S3, token-based chunking, and the Qdrant, pgvector, Pinecone, Weaviate and Elasticsearch vector DBs. They don't include Docling, OCR, local transcription, Chroma, Milvus, LanceDB or FAISS: for those, build the image with the extras you need.

Tag
latest, latest-slim The latest release
0.1.0, 0.1, 0.1.0-slim, ... A release, or the latest patch of a minor version
edge, edge-slim The main branch, updated on every push that changes the image
sha-<commit>, sha-<commit>-slim One commit

Pin a version in production (:0.1.0), so an upgrade only happens when you choose it. The entrypoint migrates the database on start, as in a local build.

Without compose, give the container your settings and a volume:

docker run -d --name pagelore -p 8000:8000 \
  --env-file docker/env/.env.app \
  -v pagelore_data:/app/src/assets -v pagelore_models:/home/pagelore/.cache \
  ghcr.io/saqrianoo/pagelore:latest

Services

Service Address
Pagelore API http://localhost:8000/docs Runs alembic upgrade head on every start
PostgreSQL 18 + pgvector localhost:5432 Metadata DB, and the vector DB if VECTOR_DB_BACKEND=PGVECTOR
Qdrant http://localhost:6333 The default vector DB
pgAdmin http://localhost:8080 Add a server with host postgres, port 5432

The databases listen on 127.0.0.1 only. Data lives in named volumes, so ./run.sh stop (or docker compose down) keeps it:

Volume Holds
pgdata Postgres data
qdrant_data Qdrant collections
fastapi_data Uploaded originals and embedded vector DBs (/app/src/assets)
model_cache Downloaded models (Hugging Face, FastEmbed)
pgadmin-data pgAdmin settings

Build options

Set these in the shell or in docker/.env:

PAGELORE_EXTRAS=fastembed,ollama,ocr,s3     # optional dependencies, or "all"
SYSTEM_PACKAGES="tesseract-ocr libreoffice-core"
PYTHON_VERSION=3.13                         # 3.10 or newer (default 3.12)
APP_PORT=8000  POSTGRES_HOST_PORT=5433  QDRANT_HOST_PORT=6333  PGADMIN_HOST_PORT=8080
Option Default
PAGELORE_EXTRAS sentence-transformers The extras baked into the image, comma separated, or all
SYSTEM_PACKAGES empty Debian packages: tesseract-ocr (+ tesseract-ocr-<lang>) for OCR, libreoffice-core for legacy Office files (~400 MB)
PYTHON_VERSION 3.12 Python of the image
APP_PORT 8000 Host port of the API
POSTGRES_HOST_PORT 5432 Host port of Postgres
QDRANT_HOST_PORT / QDRANT_GRPC_HOST_PORT 6333 / 6334 Host ports of Qdrant
PGADMIN_HOST_PORT 8080 Host port of pgAdmin

./run.sh docker --extras a,b sets PAGELORE_EXTRAS for you.

The image

docker/pagelore/Dockerfile builds in two stages:

  1. Builder: python:<version>-slim-trixie with uv. It installs the locked dependencies (uv sync --frozen --no-dev) with the extras you asked for. A C compiler is available for dependencies without a wheel on a new Python release.
  2. Runtime: the same base image, the virtual environment, the src folder and the optional system packages. It runs as the unprivileged user pagelore (uid 1000).

The entrypoint runs the Alembic migrations, then uvicorn main:app on port 8000. Migrations hold a Postgres advisory lock, so replicas that start together migrate only once (Database migrations).

On Linux, and so in the image, PyTorch is installed as the CPU build: the default PyPI build pulls about 3 GB of CUDA libraries. For a GPU, serve the model with Ollama, Text Embeddings Inference (TEI) or vLLM instead. host.docker.internal reaches servers running on the host, for example EMBEDDING_URL="http://host.docker.internal:11434" for Ollama.

The container's health check calls GET /api/v1/. GET /api/v1/health also checks that Postgres and the vector DB answer (503 when not), for a load balancer or a readiness probe. The first start can take a few minutes while the embedding model downloads.