Merge pull request #393 from Cilenco/fix/rootless-docker-run

This commit is contained in:
Dionisio Pozo
2026-05-29 22:01:54 +02:00
committed by GitHub
+7 -3
View File
@@ -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