# Dokploy blueprint compose for the systemprompt gateway.
# Canonical copy: systempromptio/systemprompt-template deploy/dokploy/,
# published to Dokploy/templates blueprints/systemprompt/.
# Dokploy conventions: version 3.8, no ports/container_name/networks,
# main service name MUST equal the blueprint folder name (systemprompt).
version: "3.8"
services:
  systemprompt:
    image: ghcr.io/systempromptio/systemprompt-template:0
    restart: unless-stopped
    depends_on:
      postgres:
        condition: service_healthy
    environment:
      DATABASE_URL: postgres://systemprompt:${POSTGRES_PASSWORD}@postgres:5432/systemprompt
      ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY}
      OPENAI_API_KEY: ${OPENAI_API_KEY}
      GEMINI_API_KEY: ${GEMINI_API_KEY}
      EXTERNAL_URL: ${EXTERNAL_URL}
      HOST: 0.0.0.0
      PORT: 8080
    expose:
      - 8080
    volumes:
      - systemprompt_web:/app/web
      - systemprompt_storage:/app/storage/data
      - systemprompt_profiles:/app/services/profiles/docker
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/api/v1/health"]
      interval: 30s
      timeout: 10s
      start_period: 300s
      retries: 3

  postgres:
    image: postgres:18-alpine
    restart: unless-stopped
    environment:
      POSTGRES_USER: systemprompt
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: systemprompt
    volumes:
      # postgres:18+ stores data under major-version subdirectories of
      # /var/lib/postgresql — mounting the old .../data path aborts startup.
      - postgres_data:/var/lib/postgresql
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U systemprompt -d systemprompt"]
      interval: 5s
      timeout: 5s
      retries: 10

volumes:
  systemprompt_web:
  systemprompt_storage:
  systemprompt_profiles:
  postgres_data:
