# PhotoPrism - Photo management
# Port: 2342
# AI-powered photo management

version: "3.9"
services:
  db:
    image: mariadb:jammy
    container_name: PhotoPrism-DB
    hostname: photoprism-db
    mem_limit: 1g
    cpu_shares: 768
    security_opt:
      - no-new-privileges:true
      - seccomp:unconfined
      - apparmor:unconfined
    user: 1000:1000
    healthcheck:
      test: ["CMD-SHELL", "mysqladmin ping -u root -p$$MYSQL_ROOT_PASSWORD | grep 'mysqld is alive' || exit 1"]
    volumes:
      - /home/vish/docker/photoprism/db:/var/lib/mysql:rw
    environment:
      TZ: America/Los_Angeles
      MYSQL_ROOT_PASSWORD: "REDACTED_PASSWORD"
      MYSQL_DATABASE: photoprism
      MYSQL_USER: photoprism-user
      MYSQL_PASSWORD: "REDACTED_PASSWORD"
    restart: on-failure:5

  photoprism:
    image: photoprism/photoprism:latest
    container_name: PhotoPrism
    hostname: photoprism
    mem_limit: 6g
    cpu_shares: 1024
    security_opt:
      - no-new-privileges:true
      - seccomp:unconfined
      - apparmor:unconfined
    user: 1000:1009
    healthcheck:
      test: wget --no-verbose --tries=1 --spider http://localhost:2342
    ports:
      - 2342:2342
    volumes:
      - /home/vish/docker/photoprism/import:/photoprism/import:rw       # *Optional* base folder from which files can be imported to originals
      - /home/vish/docker/photoprism/storage:/photoprism/storage:rw
      - /home/vish/docker/photoprism/originals:/photoprism/originals:rw
#     - /volume1/docker/photoprism/family:/photoprism/originals/family:rw               # *Additional* media folders can be mounted like this
    environment:
      PHOTOPRISM_ADMIN_USER: vish
      PHOTOPRISM_ADMIN_PASSWORD: "REDACTED_PASSWORD"
      PHOTOPRISM_UID: 1000
      PHOTOPRISM_GID: 1000
      PHOTOPRISM_AUTH_MODE: password
      PHOTOPRISM_SITE_URL: http://localhost:2342/
      PHOTOPRISM_ORIGINALS_LIMIT: 5120
      PHOTOPRISM_HTTP_COMPRESSION: gzip
      PHOTOPRISM_READONLY: false
      PHOTOPRISM_EXPERIMENTAL: false
      PHOTOPRISM_DISABLE_CHOWN: false
      PHOTOPRISM_DISABLE_WEBDAV: false
      PHOTOPRISM_DISABLE_SETTINGS: false
      PHOTOPRISM_DISABLE_TENSORFLOW: false
      PHOTOPRISM_DISABLE_FACES: false
      PHOTOPRISM_DISABLE_CLASSIFICATION: false
      PHOTOPRISM_DISABLE_RAW: false
      PHOTOPRISM_RAW_PRESETS: false
      PHOTOPRISM_JPEG_QUALITY: 100
      PHOTOPRISM_DETECT_NSFW: false
      PHOTOPRISM_UPLOAD_NSFW: true
      PHOTOPRISM_SPONSOR: true
      PHOTOPRISM_DATABASE_DRIVER: mysql
      PHOTOPRISM_DATABASE_SERVER: photoprism-db:3306
      PHOTOPRISM_DATABASE_NAME: photoprism
      PHOTOPRISM_DATABASE_USER: photoprism-user
      PHOTOPRISM_DATABASE_PASSWORD: "REDACTED_PASSWORD"
      PHOTOPRISM_WORKERS: 2
      PHOTOPRISM_THUMB_FILTER: blackman       # best to worst: blackman, lanczos, cubic, linear
      PHOTOPRISM_APP_MODE: standalone         # progressive web app MODE - fullscreen, standalone, minimal-ui, browser
#     PHOTOPRISM_SITE_CAPTION: "AI-Powered Photos App"
#     PHOTOPRISM_SITE_DESCRIPTION: ""
#     PHOTOPRISM_SITE_AUTHOR: ""
    working_dir: "/photoprism"
    restart: on-failure:5
    depends_on:
      db:
        condition: service_started
