# Reactive Resume v4 - Updated for latest version
# Docs: https://docs.rxresu.me/self-hosting/docker

services:
  db:
    image: postgres:16
    container_name: Resume-DB
    hostname: resume-db
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U resumeuser -d resume"]
      timeout: 5s
      interval: 10s
      retries: 10
    volumes:
      - /volume1/docker/rxv4/db:/var/lib/postgresql:rw
    environment:
      POSTGRES_DB: resume
      POSTGRES_USER: resumeuser
      POSTGRES_PASSWORD: "REDACTED_PASSWORD"
    restart: unless-stopped

  minio:
    image: minio/minio:latest
    command: server /data
    container_name: Resume-MINIO
    hostname: minio
    security_opt:
      - no-new-privileges:true
    user: 1026:100
    healthcheck:
      test: ["CMD", "mc", "ready", "local"]
      interval: 5s
      timeout: 5s
      retries: 5
    ports:
      - 9753:9000
    volumes:
      - /volume1/docker/rxv4/data:/data:rw
    environment:
      MINIO_ROOT_USER: minioadmin
      MINIO_ROOT_PASSWORD: "REDACTED_PASSWORD"
    restart: unless-stopped

  printer:
    image: ghcr.io/browserless/chromium:latest
    container_name: Resume-PRINTER
    hostname: printer
    restart: unless-stopped
    environment:
      HEALTH: "true"
      CONCURRENT: "20"
      QUEUED: "10"
    healthcheck:
      test: ["CMD-SHELL", "wget -q --spider http://localhost:3000/json/version || exit 1"]
      interval: 10s
      timeout: 5s
      retries: 10

  resume:
    image: amruthpillai/reactive-resume:latest
    container_name: Resume-ACCESS
    hostname: resume
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    ports:
      - 9751:3000
    volumes:
      - /volume1/docker/rxv4/uploads:/app/data:rw
    environment:
      # --- Server ---
      TZ: "America/Chicago"
      APP_URL: "https://rxv4access.vishconcord.synology.me"
      PRINTER_APP_URL: "http://resume:3000"

      # --- Printer ---
      PRINTER_ENDPOINT: "ws://printer:3000"

      # --- Database ---
      DATABASE_URL: "postgresql://resumeuser:REDACTED_PASSWORD@resume-db:5432/resume"

      # --- Authentication ---
      # Generated with: openssl rand -hex 32
      AUTH_SECRET: "d5c3e165dafd2d82bf84acacREDACTED_GITEA_TOKEN"

      # --- Email (SMTP) ---
      SMTP_HOST: "smtp.gmail.com"
      SMTP_PORT: "587"
      SMTP_USER: "your-email@example.com"
      SMTP_PASS: "REDACTED_PASSWORD"
      SMTP_FROM: "Reactive Resume <your-email@example.com>"
      SMTP_SECURE: "false"

      # --- Storage (S3/MinIO) ---
      S3_ACCESS_KEY_ID: "minioadmin"
      S3_SECRET_ACCESS_KEY: "miniopass"
      S3_REGION: "us-east-1"
      S3_ENDPOINT: "http://minio:9000"
      S3_BUCKET: "default"
      S3_FORCE_PATH_STYLE: "true"

      # --- Feature Flags ---
      FLAG_DISABLE_SIGNUPS: "false"
      FLAG_DISABLE_EMAIL_AUTH: "false"

    depends_on:
      db:
        condition: service_healthy
      minio:
        condition: service_healthy
      printer:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
      interval: 30s
      timeout: 10s
      retries: 3
