aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Dockerfile16
1 files changed, 11 insertions, 5 deletions
diff --git a/Dockerfile b/Dockerfile
index 6fbff9cc..94b3d4b5 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -98,11 +98,10 @@ LABEL org.opencontainers.image.title=slskd \
WORKDIR /slskd
COPY --from=publish /slskd/dist/${TARGETPLATFORM} .
-# supports two modes:
-# 1. --user / user: (modern Docker) — container starts as non-root,
-# skips all usermod/chown, execs the app directly.
-# 2. PUID/PGID (legacy linuxserver style) — container starts as root,
-# mutates user, chowns /app if needed, drops privileges via gosu.
+# supports three modes:
+# 1. --user / user: (modern Docker) — container starts as non-root, skips all usermod/chown, execs the app directly.
+# 2. PUID/PGID (legacy linuxserver style) — container starts as root, mutates user, chowns /app if needed, drops privileges via gosu.
+# 3. neither --user nor at least one of PUID/PGID supplied - container and app run as root
COPY <<'SCRIPT' /entrypoint.sh
#!/bin/bash
set -e
@@ -129,6 +128,13 @@ if [ "$(id -u)" -ne 0 ]; then
exec "$@"
fi
+# no --user supplied, neither PUID nor PGID supplied, run as root (same behavior as < 0.25.0)
+#---------------------------------------------------------------------------------------
+if [ -z "${PUID}" ] && [ -z "${PGID}" ]; then
+ umask "$SLSKD_UMASK"
+ exec "$@"
+fi
+
# PUID/PGID mode; user has provided explicit user and group IDs to use
#---------------------------------------------------------------------------------------
PUID="${PUID:-1000}"