version: '3.8'

# Running `docker-compose -f docker-compose.rootless.yml up` will create/use the "trilium-data" directory in the user home
# Run `TRILIUM_DATA_DIR=/path/of/your/choice docker-compose -f docker-compose.rootless.yml up` to set a different directory
# To run in the background, use `docker-compose -f docker-compose.rootless.yml up -d`
# To use the Alpine-based image, run with `TRILIUM_VARIANT=alpine docker-compose -f docker-compose.rootless.yml up`
services:
  trilium:
    # Optionally, replace `latest` with a version tag like `v0.90.3`
    # Using `latest` may cause unintended updates to the container
    image: triliumnext/notes:rootless
    restart: unless-stopped
    environment:
      - TRILIUM_DATA_DIR=/home/trilium/trilium-data
      # Set the desired UID/GID for the Trilium process. Will be used during docker run
      # These should match the owner of your data directory on the host
      - TRILIUM_UID=${TRILIUM_UID:-1001}
      - TRILIUM_GID=${TRILIUM_GID:-1001}
    # Use the specified UID/GID for the container process
    user: ${TRILIUM_UID:-1001}:${TRILIUM_GID:-1001}
    ports:
      # By default, Trilium will be available at http://localhost:8080
      # It will also be accessible at http://<host-ip>:8080
      # You might want to limit this with something like Docker Networks, reverse proxies, or firewall rules
      - '8080:8080'
    volumes:
      # Unless TRILIUM_DATA_DIR is set, the data will be stored in the "trilium-data" directory in the home directory.
      # This can also be changed by replacing the line below with `- /path/of/your/choice:/home/trilium/trilium-data
      - ${TRILIUM_DATA_DIR:-~/trilium-data}:/home/trilium/trilium-data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
