#!/bin/sh # SPDX-License-Identifier: AGPL-3.0-or-later # docwell-server entrypoint. Started as root only to make the data directory # writable for the docwell user: a host bind mount, or a volume created by an # older image, arrives owned by root, and the search index could not be # written. Then it drops to docwell for good. set -eu DATA_DIR="${DOCWELL_DATA_DIR:-/data}" if [ "$(id -u)" = "0" ]; then mkdir -p "$DATA_DIR" if [ "$(stat -c %u "$DATA_DIR")" != "10001" ]; then echo "Fixing $DATA_DIR ownership for docwell (uid=10001)" chown -R docwell:docwell "$DATA_DIR" fi exec su-exec docwell docwell-server "$@" fi # Already unprivileged (e.g. `user:` set in compose): run as is. exec docwell-server "$@"