# ─────────────────────────────────────────────
# QRknit — docker-compose.yml
# For local dev or non-Unraid deployments
# On Unraid: use the Docker tab UI instead
# ─────────────────────────────────────────────

services:
  qrknit:
    build: .
    # Or use a pre-built image from Docker Hub:
    # image: yourdockerhubuser/qrknit:latest
    container_name: qrknit
    restart: unless-stopped

    ports:
      - "5000:5000"       # Change left side to use a different host port
                          # e.g. "80:5000" to serve on port 80

    volumes:
      - qrknit-data:/app/data   # Persistent SQLite database

    environment:
      - BASE_URL=https://yourdomain.com     # ← Your public URL (domain or subdomain)
      - APP_NAME=My.Links                  # ← Displayed in the UI header/logo/title
      - ADMIN_USERNAME=admin                # ← Admin account username (default: admin)
      - PORT=5000
      - DEBUG=false
      - SECRET_KEY=replace-with-a-long-random-string   # ← Change this!
      - ADMIN_PASSWORD=replace-with-a-strong-password  # ← Change this!
      - COOKIE_SECURE=false                 # Set to true only if Flask receives HTTPS directly (not behind a proxy)

    # Optional: resource limits
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 256M

    healthcheck:
      test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5000/api/health')"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 15s

volumes:
  qrknit-data:
    driver: local
