Docker Compose

Docker compose simplifies the configuration of containers and connected services. Following example starts the HomeGallery with a local API server.

 1version: "3.9"
 2services:
 3  api:
 4    # custom build via
 5    #build: packages/api-server
 6    image: xemle/home-gallery-api-server
 7    environment:
 8      # TensorflowJS backends
 9      # - cpu: slowest and best support
10      # - wasm: good perfromance for arm64 and amd64 platforms
11      # - node: best performance on amd64 platform
12      #- BACKEND=cpu
13      - BACKEND=wasm
14      #- BACKEND=node
15  gallery:
16    # custom build via
17    #build: .
18    image: xemle/home-gallery
19    environment:
20      - GALLERY_API_SERVER=http://api:3000
21      - GALLERY_API_SERVER_CONCURRENT=1 # for SoC devices like Rasperry Pi. Use 5 otherwise
22      - GALLERY_API_SERVER_TIMEOUT=60 # for SoC devices like Rasperry Pi. Use 30 otherwise
23      #- GALLERY_USE_NATIVE=ffprobe,ffmpeg,vipsthumbnail # On issues with sharp resizer
24      - GALLERY_OPEN_BROWSER=false
25      # Use polling for safety of possible network mounts. Try 0 to use inotify via fs.watch
26      - GALLERY_WATCH_POLL_INTERVAL=300
27    volumes:
28      - ./data:/data
29      # Mount your media directories below /data
30      - ${HOME}/Pictures:/data/Pictures
31    ports:
32      - "3000:3000"
33    user: "${CURRENT_USER}"
34    entrypoint: ['node', '/app/gallery.js']
35    command: ['run', 'server']

Note

By default the wasm backend for the API server is used for best support on most platforms (SoS, NAS, cloud and desktop). Use node backend for best performance on amd64 CPUs like desktops. Please validate that the backend node works for you.

Quickstart

1mkdir -p data
2echo "CURRENT_USER=$(id -u):$(id -g)" >> .env
3docker compose run gallery run init --source /data/Pictures
4docker compose up -d

Note

The docker container is configured to poll image sources each 5 minutes for compatibility reasons of slow or large media volumes. Check if inotify through disabled polling by GALLERY_WATCH_POLL_INTERVAL=0 is working for you.

Run the CLI

The CLI with all commands is started via docker compose

1docker compose run gallery -h

This CLI is attached to the pseudo-tty. To run it as background job like in cron jobs, pleas use -T argument

1docker compose run -T gallery -h