Auto-create and chown data dirs on first start

Entrypoint runs as root, ensures /data/{db,uploads,logo} and
/webdav-config exist with UID 1000 ownership, then drops privileges
via gosu. Removes the manual sudo chown step from the README and
makes a fresh docker compose up succeed without prep.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Hacker
2026-04-16 13:20:02 +02:00
parent d476784c06
commit 20e61aa61c
4 changed files with 22 additions and 7 deletions
+11
View File
@@ -0,0 +1,11 @@
#!/bin/sh
set -e
# Wenn die Bind-Mounts (data/db, data/uploads, data/logo) auf dem Host noch
# nicht existieren, legt Docker sie als root an — der App-Prozess (UID 1000)
# könnte dann nicht reinschreiben ("readonly database"). Das fangen wir hier ab.
mkdir -p /data/db /data/uploads /data/logo /webdav-config
chown -R 1000:1000 /data /webdav-config 2>/dev/null || true
# Privilegien fallen lassen und das eigentliche Kommando als UID 1000 ausführen.
exec gosu 1000:1000 "$@"