# docker-compose.yml — Local development (SQLite)
#
# Single container: Go backend + nginx frontend.
# No Postgres, no sidecar, no PVC — just a mounted data directory.
#
# Usage:
#   docker compose up --build
#   open http://localhost:3000
#
# Data persists in the `sb_data` named volume between restarts.
# To reset: docker compose down -v
#
# For Postgres / multi-replica / k8s deployment see k8s/ and Dockerfile.

services:
  switchboard:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: switchboard-core
    environment:
      PORT: "8080"
      BASE_PATH: ""
      DB_DRIVER: sqlite
      DATABASE_URL: /data/switchboard.db
      JWT_SECRET: ${JWT_SECRET:-change-me-for-production}
      ENCRYPTION_KEY: ${ENCRYPTION_KEY:-change-me-for-production}
      SWITCHBOARD_ADMIN_USERNAME: ${ADMIN_USERNAME:-admin}
      SWITCHBOARD_ADMIN_PASSWORD: ${ADMIN_PASSWORD:-admin}
      STORAGE_BACKEND: pvc
      STORAGE_PATH: /data/storage
      CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:-http://localhost:3000}
      EXT_ALLOW_PRIVATE_IPS: ${EXT_ALLOW_PRIVATE_IPS:-true}
      LOG_FORMAT: ${LOG_FORMAT:-text}
      LOG_LEVEL: ${LOG_LEVEL:-info}
      BUNDLED_PACKAGES: ${BUNDLED_PACKAGES:-}
      # Dev seed users — ignored if ENVIRONMENT=production
      SEED_USERS: ${SEED_USERS:-alice:password123:user,bob:password456:user,charlie:password789:user}
    volumes:
      - sb_data:/data
    ports:
      - "3000:80"
    restart: unless-stopped

volumes:
  sb_data:
