services:
  paperless:
    image: ghcr.io/paperless-ngx/paperless-ngx:latest
    container_name: paperless
    restart: unless-stopped
    depends_on:
      - paperless-db
      - paperless-redis
      - paperless-tika
      - paperless-gotenberg
    ports:
      - 8777:8000
    environment:
      - USERMAP_UID=99
      - USERMAP_GID=100
      - PAPERLESS_REDIS=redis://paperless-redis:6379
      - PAPERLESS_DBHOST=paperless-db
      - PAPERLESS_TIKA_ENABLED=1
      - PAPERLESS_TIKA_GOTENBERG_ENDPOINT=http://paperless-gotenberg:3000
      - PAPERLESS_TIKA_ENDPOINT=http://paperless-tika:9998
      - PAPERLESS_SECRET_KEY=${PAPERLESS_SECRET_KEY}
      - PAPERLESS_URL=https://paperless.rishighan.com
      - PAPERLESS_TIME_ZONE=America/Chicago
      - PAPERLESS_OCR_LANGUAGE=eng
      - PAPERLESS_ADMIN_USER=${PAPERLESS_ADMIN_USER}
      - PAPERLESS_ADMIN_PASSWORD=${PAPERLESS_ADMIN_PASSWORD}
    volumes:
      - /mnt/user/data/paperless/data:/usr/src/paperless/data
      - /mnt/user/data/paperless/media:/usr/src/paperless/media
      - /mnt/user/data/paperless/export:/usr/src/paperless/export
      - /mnt/user/data/paperless/consume:/usr/src/paperless/consume
  paperless-db:
    image: postgres:16
    container_name: paperless-db
    restart: unless-stopped
    environment:
      - POSTGRES_DB=paperless
      - POSTGRES_USER=paperless
      - POSTGRES_PASSWORD=${PAPERLESS_DB_PASSWORD}
    volumes:
      - /mnt/user/data/paperless/pgdata:/var/lib/postgresql/data
  paperless-redis:
    image: redis:7
    container_name: paperless-redis
    restart: unless-stopped
    volumes:
      - /mnt/user/data/paperless/redis:/data
  paperless-tika:
    image: apache/tika:latest
    container_name: paperless-tika
    restart: unless-stopped
  paperless-gotenberg:
    image: gotenberg/gotenberg:8
    container_name: paperless-gotenberg
    restart: unless-stopped
    command:
      - "gotenberg"
      - "--chromium-disable-javascript=true"
      - "--chromium-allow-list=file:///tmp/.*"
  scanservjs:
    image: sbs20/scanservjs:latest
    container_name: scanservjs
    restart: unless-stopped
    volumes:
      - /mnt/user/appdata/scanservjs:/app/config
      - /mnt/user/data/paperless/consume:/var/lib/scanservjs/output
      - /mnt/user/appdata/scanservjs/airscan.conf:/etc/sane.d/airscan.conf
    ports:
      - "8780:8080"

  onlyoffice:
    image: onlyoffice/documentserver:latest
    container_name: onlyoffice
    restart: unless-stopped
    ports:
      - 8089:80
      - 4430:443
    environment:
      - TZ=America/Los_Angeles
      - JWT_SECRET=secret123
    volumes:
      - /mnt/user/appdata/onlyofficeds/Data:/var/www/onlyoffice/Data
      - /mnt/user/appdata/onlyofficeds/logs:/var/log/onlyoffice
      - /mnt/user/appdata/onlyofficeds/fonts:/usr/share/fonts
