# Shade Prekey Server — Dokploy/Docker Compose deployment
#
# Usage:
#   docker compose up -d
#
# The SQLite database is persisted to a named volume so data survives
# container restarts. To use PostgreSQL instead, set SHADE_PREKEY_PG_URL
# and uncomment the depends_on / postgres service block below.

services:
  shade-prekey:
    build:
      context: ../..
      dockerfile: packages/shade-server/Dockerfile
    image: shade-prekey-server:latest
    restart: unless-stopped
    ports:
      - "3900:3900"
    volumes:
      - shade-data:/data
    environment:
      - PORT=3900
      - SHADE_PREKEY_DB_PATH=/data/shade-prekeys.db
      - SHADE_LOG_LEVEL=info
    healthcheck:
      test: ["CMD", "curl", "-fsS", "http://localhost:3900/health"]
      interval: 30s
      timeout: 5s
      start_period: 10s
      retries: 3
    # Uncomment for PostgreSQL backend:
    # depends_on:
    #   - postgres
    # environment:
    #   - SHADE_PREKEY_PG_URL=postgres://shade:shade@postgres:5432/shade

  # Uncomment to use PostgreSQL instead of SQLite:
  # postgres:
  #   image: postgres:16-alpine
  #   restart: unless-stopped
  #   environment:
  #     - POSTGRES_USER=shade
  #     - POSTGRES_PASSWORD=shade
  #     - POSTGRES_DB=shade
  #   volumes:
  #     - shade-pg-data:/var/lib/postgresql/data

volumes:
  shade-data:
  # shade-pg-data:
