Skip to main content
Learn how to deploy VectoriaDB in Docker containers.

Dockerfile

Dockerfile
FROM node:22-slim

WORKDIR /app

# Install dependencies
COPY package*.json ./
RUN npm ci --only=production

# Copy application code
COPY . .

# Create cache directories
RUN mkdir -p .cache/transformers .cache/vectoriadb

# Pre-download embedding model (optional but recommended)
RUN node -e "require('@huggingface/transformers').pipeline('feature-extraction', 'Xenova/all-MiniLM-L6-v2')"

# Set environment variables
ENV NODE_ENV=production
ENV VECTORIA_CACHE_DIR=./.cache/vectoriadb
ENV VECTORIA_MODEL_CACHE=./.cache/transformers

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s \
  CMD curl -f http://localhost:3000/health || exit 1

EXPOSE 3000

CMD ["node", "dist/server.js"]

docker-compose.yml

docker-compose.yml
version: '3.8'

services:
  app:
    build: .
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=production
      - VECTORIA_USE_HNSW=true
      - VECTORIA_MAX_DOCS=100000
      - REDIS_URL=redis://redis:6379
    volumes:
      - vectoria-cache:/app/.cache
    depends_on:
      - redis
    deploy:
      resources:
        limits:
          memory: 2G
        reservations:
          memory: 1G

  redis:
    image: redis:7-alpine
    volumes:
      - redis-data:/data
    command: redis-server --appendonly yes

volumes:
  vectoria-cache:
  redis-data:

Multi-Stage Build

For smaller images:
Dockerfile.multistage
# Build stage
FROM node:22-slim AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

# Production stage
FROM node:22-slim
WORKDIR /app

# Copy built assets
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./

# Create cache directories
RUN mkdir -p .cache/transformers .cache/vectoriadb

ENV NODE_ENV=production
EXPOSE 3000
CMD ["node", "dist/server.js"]

Volume Mounts

Mount cache directories for persistence:
docker-compose.yml
volumes:
  - ./cache/transformers:/app/.cache/transformers
  - ./cache/vectoriadb:/app/.cache/vectoriadb
Or use named volumes:
docker-compose.yml
volumes:
  vectoria-cache:

services:
  app:
    volumes:
      - vectoria-cache:/app/.cache

Resource Limits

Set appropriate memory limits:
docker-compose.yml
deploy:
  resources:
    limits:
      memory: 2G    # For ~100k documents
    reservations:
      memory: 1G

Memory Guidelines

DocumentsRecommended Memory
10,000512MB
50,0001GB
100,0002GB
500,0008GB

Kubernetes Deployment

k8s/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: vectoriadb-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: vectoriadb-app
  template:
    metadata:
      labels:
        app: vectoriadb-app
    spec:
      containers:
        - name: app
          image: your-registry/vectoriadb-app:latest
          ports:
            - containerPort: 3000
          env:
            - name: VECTORIA_USE_HNSW
              value: "true"
            - name: REDIS_URL
              valueFrom:
                secretKeyRef:
                  name: redis-secret
                  key: url
          resources:
            limits:
              memory: 2Gi
            requests:
              memory: 1Gi
          livenessProbe:
            httpGet:
              path: /health
              port: 3000
            initialDelaySeconds: 60
            periodSeconds: 30
          readinessProbe:
            httpGet:
              path: /ready
              port: 3000
            initialDelaySeconds: 30
            periodSeconds: 10

Production Config

Configuration options

Environment Variables

Env var reference

Health Monitoring

Monitoring setup