# Docker Compose for local development and Synology NAS deployment
version: '3.8'

services:
  portal:
    build: .
    container_name: mosis-portal
    restart: unless-stopped
    ports:
      - "8080:8080"
    environment:
      - LISTEN_ADDR=:8080
      - BASE_URL=https://portal.mosis.dev
      - DATABASE_PATH=/data/portal.db
      - PACKAGES_DIR=/packages
      - BACKUPS_DIR=/backups
      - JWT_SECRET=${JWT_SECRET:-change-me-in-production}
      - GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID:-}
      - GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET:-}
      - GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID:-}
      - GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET:-}
    volumes:
      # On Synology NAS, mount to /volume1/mosis/
      - ./data:/data
      - ./packages:/packages
      - ./backups:/backups
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"]
      interval: 30s
      timeout: 3s
      retries: 3
