#!/bin/sh # Archivum container entrypoint # Runs as root, creates directories, fixes permissions, then drops to PUID:PGID. set -e PUID="${PUID:-1000}" PGID="${PGID:-1000}" echo "[entrypoint] starting as uid=$(id -u) gid=$(id -g)" echo "[entrypoint] target PUID=${PUID} PGID=${PGID}" # ── Ensure required directories exist ────────────────────────────────────── mkdir -p /config mkdir -p /data/wiki mkdir -p /data/db # ── Fix ownership so the app user can read/write all volumes ─────────────── # This is needed because: # - bind-mounted directories from the host may be owned by root # - Docker Desktop on Windows mounts volumes with host permissions # that don't map to the container user chown -R "${PUID}:${PGID}" /config /data echo "[entrypoint] /config and /data ownership set to ${PUID}:${PGID}" # ── Drop privileges and exec the application ─────────────────────────────── echo "[entrypoint] exec archivum as ${PUID}:${PGID}" exec su-exec "${PUID}:${PGID}" /usr/local/bin/archivum "$@"