version: "3.9"
services:
  shopify-ai-builder:
    build: .
    ports:
      - "4500:4500"
    restart: unless-stopped
    environment:
      - OPENCODE_API_KEY=${OPENCODE_API_KEY:-}
      - XDG_DATA_HOME=/home/web/data/.opencode/local_share
      - GITHUB_PAT=${GITHUB_PAT:-}
      - GITHUB_PAT_FILE=${GITHUB_PAT_FILE:-/run/secrets/GITHUB_PAT}
      - GITHUB_USERNAME=${GITHUB_USERNAME:-}
      - GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID:-}
      - GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET:-}
      - OPENROUTER_API_KEY=${OPENROUTER_API_KEY:-}
      - OPENROUTER_API_URL=${OPENROUTER_API_URL:-}
      - OPENROUTER_MODEL_PRIMARY=${OPENROUTER_MODEL_PRIMARY:-}
      - OPENROUTER_MODEL_BACKUP_1=${OPENROUTER_MODEL_BACKUP_1:-}
      - OPENROUTER_MODEL_BACKUP_2=${OPENROUTER_MODEL_BACKUP_2:-}
      - OPENROUTER_MODEL_BACKUP_3=${OPENROUTER_MODEL_BACKUP_3:-}
      - OPENROUTER_DEFAULT_MODEL=${OPENROUTER_DEFAULT_MODEL:-}
      - OPENROUTER_FALLBACK_MODELS=${OPENROUTER_FALLBACK_MODELS:-}
      - OPENROUTER_PLAN_PROMPT_PATH=${OPENROUTER_PLAN_PROMPT_PATH:-}
      - OPENROUTER_APP_NAME=${OPENROUTER_APP_NAME:-}
      - OPENROUTER_SITE_URL=${OPENROUTER_SITE_URL:-}
      - MISTRAL_API_KEY=${MISTRAL_API_KEY:-}
      - MISTRAL_API_URL=${MISTRAL_API_URL:-}
      - MISTRAL_MODEL_PRIMARY=${MISTRAL_MODEL_PRIMARY:-}
      - MISTRAL_MODEL_BACKUP_1=${MISTRAL_MODEL_BACKUP_1:-}
      - MISTRAL_MODEL_BACKUP_2=${MISTRAL_MODEL_BACKUP_2:-}
      - GROQ_API_KEY=${GROQ_API_KEY:-}
      - GROQ_API_TOKEN=${GROQ_API_TOKEN:-}
      - GOOGLE_API_KEY=${GOOGLE_API_KEY:-}
      - NVIDIA_API_KEY=${NVIDIA_API_KEY:-}
      - REPO_URL=${REPO_URL:-}
      - REPO_BRANCH=${REPO_BRANCH:-main}
      - ACCESS_PASSWORD=${ACCESS_PASSWORD:-}
      - DODO_PAYMENTS_API_KEY=${DODO_PAYMENTS_API_KEY:-}
      - DODO_PAYMENTS_ENV=${DODO_PAYMENTS_ENV:-test}
      - DODO_PAYMENTS_WEBHOOK_KEY=${DODO_PAYMENTS_WEBHOOK_KEY:-}
      - DODO_TOPUP_1_USD=${DODO_TOPUP_1_USD:-}
      - DODO_TOPUP_1_GBP=${DODO_TOPUP_1_GBP:-}
      - DODO_TOPUP_1_EUR=${DODO_TOPUP_1_EUR:-}
      - DODO_TOPUP_2_USD=${DODO_TOPUP_2_USD:-}
      - DODO_TOPUP_2_GBP=${DODO_TOPUP_2_GBP:-}
      - DODO_TOPUP_2_EUR=${DODO_TOPUP_2_EUR:-}
      - DODO_TOPUP_3_USD=${DODO_TOPUP_3_USD:-}
      - DODO_TOPUP_3_GBP=${DODO_TOPUP_3_GBP:-}
      - DODO_TOPUP_3_EUR=${DODO_TOPUP_3_EUR:-}
      - DODO_TOPUP_4_USD=${DODO_TOPUP_4_USD:-}
      - DODO_TOPUP_4_GBP=${DODO_TOPUP_4_GBP:-}
      - DODO_TOPUP_4_EUR=${DODO_TOPUP_4_EUR:-}
      - DODO_TOPUP_TOKENS_1=${DODO_TOPUP_TOKENS_1:-100000}
      - DODO_TOPUP_TOKENS_2=${DODO_TOPUP_TOKENS_2:-5000000}
      - DODO_TOPUP_TOKENS_3=${DODO_TOPUP_TOKENS_3:-20000000}
      - DODO_TOPUP_TOKENS_4=${DODO_TOPUP_TOKENS_4:-50000000}
      - DODO_MIN_AMOUNT=${DODO_MIN_AMOUNT:-50}
      # Subscription Plans - Starter
      - DODO_STARTER_MONTHLY_USD=${DODO_STARTER_MONTHLY_USD:-}
      - DODO_STARTER_YEARLY_USD=${DODO_STARTER_YEARLY_USD:-}
      - DODO_STARTER_MONTHLY_GBP=${DODO_STARTER_MONTHLY_GBP:-}
      - DODO_STARTER_YEARLY_GBP=${DODO_STARTER_YEARLY_GBP:-}
      - DODO_STARTER_MONTHLY_EUR=${DODO_STARTER_MONTHLY_EUR:-}
      - DODO_STARTER_YEARLY_EUR=${DODO_STARTER_YEARLY_EUR:-}
      # Subscription Plans - Professional
      - DODO_PROFESSIONAL_MONTHLY_USD=${DODO_PROFESSIONAL_MONTHLY_USD:-}
      - DODO_PROFESSIONAL_YEARLY_USD=${DODO_PROFESSIONAL_YEARLY_USD:-}
      - DODO_PROFESSIONAL_MONTHLY_GBP=${DODO_PROFESSIONAL_MONTHLY_GBP:-}
      - DODO_PROFESSIONAL_YEARLY_GBP=${DODO_PROFESSIONAL_YEARLY_GBP:-}
      - DODO_PROFESSIONAL_MONTHLY_EUR=${DODO_PROFESSIONAL_MONTHLY_EUR:-}
      - DODO_PROFESSIONAL_YEARLY_EUR=${DODO_PROFESSIONAL_YEARLY_EUR:-}
      # Subscription Plans - Enterprise
      - DODO_ENTERPRISE_MONTHLY_USD=${DODO_ENTERPRISE_MONTHLY_USD:-}
      - DODO_ENTERPRISE_YEARLY_USD=${DODO_ENTERPRISE_YEARLY_USD:-}
      - DODO_ENTERPRISE_MONTHLY_GBP=${DODO_ENTERPRISE_MONTHLY_GBP:-}
      - DODO_ENTERPRISE_YEARLY_GBP=${DODO_ENTERPRISE_YEARLY_GBP:-}
      - DODO_ENTERPRISE_MONTHLY_EUR=${DODO_ENTERPRISE_MONTHLY_EUR:-}
      - DODO_ENTERPRISE_YEARLY_EUR=${DODO_ENTERPRISE_YEARLY_EUR:-}
      # Pay-as-you-go
      - DODO_PAYG_USD=${DODO_PAYG_USD:-}
      - DODO_PAYG_GBP=${DODO_PAYG_GBP:-}
      - DODO_PAYG_EUR=${DODO_PAYG_EUR:-}
      - DODO_PAYG_ENABLED=${DODO_PAYG_ENABLED:-1}
      - GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID:-}
      - GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET:-}
      - PUBLIC_BASE_URL=${PUBLIC_BASE_URL:-}
      - SESSION_SECRET=${SESSION_SECRET:-}
      - ADMIN_USER=${ADMIN_USER:-}
      - ADMIN_PASSWORD=${ADMIN_PASSWORD:-}
      - ADMIN_SESSION_TTL_MS=${ADMIN_SESSION_TTL_MS:-}
      - COOKIE_SECURE=${COOKIE_SECURE:-}
      - SMTP_HOST=${SMTP_HOST:-}
      - SMTP_PORT=${SMTP_PORT:-587}
      - SMTP_SECURE=${SMTP_SECURE:-false}
      - SMTP_USER=${SMTP_USER:-}
      - SMTP_PASS=${SMTP_PASS:-}
      - SMTP_PASS_FILE=${SMTP_PASS_FILE:-}
      - SMTP_FROM=${SMTP_FROM:-}
            # Chutes AI
      - PLUGIN_COMPASS_CHUTES_API_KEY=${PLUGIN_COMPASS_CHUTES_API_KEY:-}
      - CHUTES_API_KEY=${CHUTES_API_KEY:-}
      - CHUTES_API_TOKEN=${CHUTES_API_TOKEN:-}
      - CHUTES_API_URL=${CHUTES_API_URL:-}
      # Cerebras
      - CEREBRAS_API_KEY=${CEREBRAS_API_KEY:-}
      # LLM7.io
      - LLM7_API_KEY=${LLM7_API_KEY:-}
      # AI/ML API
      - AIMLAPI_API_KEY=${AIMLAPI_API_KEY:-}
      # Routeway
      - ROUTEWAY_API_KEY=${ROUTEWAY_API_KEY:-}
      # G4F
      - G4F_API_KEY=${G4F_API_KEY:-}
      # Bytez
      - BYTEZ_API_KEY=${BYTEZ_API_KEY:-}
      # Ollama
      - OLLAMA_API_KEY=${OLLAMA_API_KEY:-}
      - OLLAMA_API_URL=${OLLAMA_API_URL:-}
      - OLLAMA_DEFAULT_MODEL=${OLLAMA_DEFAULT_MODEL:-}
    volumes:
      - pwsh_profile:/root/.config/powershell
      - web_data:/home/web/data
      - shopify_ai_logs:/var/log/shopify-ai
    stop_grace_period: 30s
    deploy:
      resources:
        limits:
          memory: 1536M

volumes:
  pwsh_profile:
    name: appbuilder_pwsh_profile
  web_data:
    name: appbuilder_workspace
  shopify_ai_logs:
    name: appbuilder_logs
