Skip to content

Docker Deployment

Chatty the Lab provides two Docker Compose files:

  • docker-compose.yml — Development setup (Supabase runs separately via CLI)
  • docker-compose.prod.yml — Production setup (includes Supabase services)

The development compose file assumes Supabase is running via supabase start on the host.

ServiceImagePortDescription
ollamaollama/ollama:latest11434Local LLM inference and embeddings
backendBuilt from ./backend5000Rust Axum API server
frontendBuilt from ./frontend3000SvelteKit application
Terminal window
# Start Supabase first (if not already running)
supabase start
# Start Docker services
docker compose up -d

Create a .env file in the project root:

Terminal window
SUPABASE_JWT_SECRET=your-jwt-secret
PUBLIC_SUPABASE_URL=http://localhost:54321
PUBLIC_SUPABASE_ANON_KEY=your-anon-key
OPENAI_KEY=sk-... # optional
MISTRAL_KEY=... # optional
GEMINI_KEY=... # optional

The compose file uses defaults for most variables. The backend connects to the host’s Supabase via host.docker.internal:54322.

The production compose file includes Supabase services and GPU support for Ollama.

ServiceImagePortDescription
supabase-dbsupabase/postgres:15.6.1.14354322PostgreSQL with pgvector
supabase-authsupabase/gotrue:v2.164.054321Authentication service
ollamaollama/ollama:latest11434LLM inference (with GPU)
backendBuilt from ./backend5000Rust Axum API server
frontendBuilt from ./frontend3000SvelteKit application
Terminal window
docker compose -f docker-compose.prod.yml up -d
Terminal window
# Required
SUPABASE_JWT_SECRET=a-strong-random-secret
POSTGRES_PASSWORD=a-strong-database-password
PUBLIC_SUPABASE_ANON_KEY=your-anon-key
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
# URLs
SITE_URL=https://tec.citius.usc.es/chatty
SUPABASE_URL=http://supabase-auth:9999
# API keys (optional)
OPENAI_KEY=sk-...
MISTRAL_KEY=...
GEMINI_KEY=...

The production compose file includes NVIDIA GPU reservation for Ollama:

ollama:
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
VolumeServicePurpose
ollama-dataollamaPersists downloaded models between restarts
supabase-db-datasupabase-dbPersists PostgreSQL data (production only)

The compose files include health checks for critical services:

  • Ollama: curl -f http://localhost:11434/ every 30s
  • Supabase DB: pg_isready -U postgres every 10s

The backend and frontend services use depends_on with condition: service_healthy to ensure dependencies are ready before starting.

FROM rust:1.82-slim AS builder
# Install dependencies, build release binary
FROM debian:bookworm-slim
# Copy binary, expose port 5000
FROM node:22-slim AS builder
# npm ci && npm run build
FROM node:22-slim
# Copy build output, expose port 3000

To rebuild after code changes:

Terminal window
docker compose build
docker compose up -d

When using the production compose file with supabase-db, you need to apply migrations manually:

Terminal window
# Copy migrations into the container and apply
for f in supabase/migrations/*.sql; do
docker compose -f docker-compose.prod.yml exec -T supabase-db \
psql -U postgres -d postgres < "$f"
done

Alternatively, mount the migrations directory as a volume and apply them on startup.