mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-06 20:28:48 +00:00
Revert "use unprivileged user in a container"
This commit is contained in:
parent
c7e4a52b99
commit
67e72fb96a
2 changed files with 17 additions and 31 deletions
|
@ -2,22 +2,8 @@
|
|||
|
||||
set -e
|
||||
|
||||
# Default to root, so old installations won't break
|
||||
export PUID=${PUID:-0}
|
||||
export PGID=${PGID:-0}
|
||||
|
||||
# This is in attempt to preserve the original behavior of the Dockerfile,
|
||||
# while also supporting the lscr.io /config directory
|
||||
[ ! -d "/app/config" ] && ln -s /config /app/config
|
||||
|
||||
# Set privileges for /app but only if pid 1 user is root and we are dropping privileges.
|
||||
# If container is run as an unprivileged user, it means owner already handled ownership setup on their own.
|
||||
# Running chown in that case (as non-root) will cause error
|
||||
[ "$(id -u)" == "0" ] && [ "${PUID}" != "0" ] && chown -R ${PUID}:${PGID} /app
|
||||
|
||||
# Drop privileges (when asked to) if root, otherwise run as current user
|
||||
if [ "$(id -u)" == "0" ] && [ "${PUID}" != "0" ]; then
|
||||
su-exec ${PUID}:${PGID} "$@"
|
||||
else
|
||||
exec "$@"
|
||||
fi
|
||||
node server.js
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue