From e87447f4e4ede8e1ffe49cd964f51409ee2208a0 Mon Sep 17 00:00:00 2001 From: Christian Dielitz Date: Mon, 25 May 2026 17:12:08 +0200 Subject: [PATCH] fix(docker) set file permissions only when running as root --- entrypoint.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index c9d83f19..5f990506 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -10,14 +10,18 @@ STORAGE_DIR="/app/storage" STATIC_DIR="/app/static" # Ensure the storage directory exists and is writable by oxicloud -if [ -d "$STORAGE_DIR" ]; then +if [[ -d "$STORAGE_DIR" && "$(id -u)" -eq 0 ]]; then chown -R oxicloud:oxicloud "$STORAGE_DIR" fi # Ensure static directory is readable -if [ -d "$STATIC_DIR" ]; then +if [[ -d "$STATIC_DIR" && "$(id -u)" -eq 0 ]]; then chown -R oxicloud:oxicloud "$STATIC_DIR" fi # Drop privileges and exec the main binary (or whatever was passed as CMD) -exec su-exec oxicloud "$@" +if [[ "$(id -u)" -eq 0 ]]; then + exec su-exec oxicloud "$@" +else + oxicloud "$@" +fi