# documentation: https://docs.paperless-ngx.com/configuration/
# slogan: Paperless-ngx is a community-supported open-source document management system that transforms your physical documents into a searchable online archive so you can keep, well, less paper.
# category: productivity
# logo: svgs/paperless.svg
# port: 8000

services:
  redis:
    image: redis:7.4
    volumes:
      - paperless-redis:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      timeout: 10s
      retries: 3

  paperless:
    image: paperlessngx/paperless-ngx:latest
    depends_on:
      redis:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "curl", "-fs", "-S", "--max-time", "2", "http://localhost:8000"]
      interval: 30s
      timeout: 10s
      retries: 5
    volumes:
      - paperless-data:/usr/src/paperless/data
      - paperless-media:/usr/src/paperless/media
      - type: bind
        source: ./export
        target: /usr/src/paperless/export
        is_directory: true
      - type: bind
        source: ./consume
        target: /usr/src/paperless/consume
        is_directory: true
    environment:
      - SERVICE_URL_PAPERLESS_8000
      - PAPERLESS_URL=$SERVICE_URL_PAPERLESS_8000
      - PAPERLESS_ADMIN_PASSWORD=${SERVICE_PASSWORD_PAPERLESS}
      - PAPERLESS_ADMIN_USER=${SERVICE_USER_PAPERLESS}
      - PAPERLESS_REDIS=redis://redis:6379
      - PAPERLESS_SECRET_KEY=${SERVICE_REALBASE64_64_PAPERLESS}
