Docker Compose

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
version: "3.9"
services:
  api:
    # custom build via
    #build: packages/api-server
    image: xemle/home-gallery-api-server
    environment:
      # TensorflowJS backends
      # - cpu: slowest and best support
      # - wasm: good perfromance for arm64 and amd64 platforms
      # - node: best performance on amd64 platform
      #- BACKEND=cpu
      - BACKEND=wasm
      #- BACKEND=node
  gallery:
    # custom build via
    #build: .
    image: xemle/home-gallery
    environment:
      - GALLERY_API_SERVER=http://api:3000
      #- GALLERY_API_SERVER_CONCURRENT=1 # On low powered devices
      #- GALLERY_API_SERVER_TIMEOUT=60 # On low powered devices
      - GALLERY_OPEN_BROWSER=false
    volumes:
      - ./data:/data
      # Mount your media directories below /data
      - ${HOME}/Pictures:/data/Pictures
    ports:
      - "3000:3000"
    user: "${CURRENT_USER}"
    entrypoint: ['node', '/app/gallery.js']
    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

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

After importing all images you can import new images by:

1
2
3
docker-compose run gallery run import --update
# For cron update task use -T to disable pseudo-tty allocation
#docker-compose run -T gallery run import --update