mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-06-16 17:36:47 +02:00
Fix for docker(-compose) to allow the app to be run as a regular user.
This commit is contained in:
parent
e7e30bf497
commit
4e01e6ac26
1 changed files with 12 additions and 3 deletions
|
@ -2,8 +2,10 @@
|
||||||
|
|
||||||
# set -e Exit the script if an error happens
|
# set -e Exit the script if an error happens
|
||||||
set -e
|
set -e
|
||||||
PUID=${PUID=0}
|
|
||||||
PGID=${PGID=0}
|
#Setting the PUID and PGID variable to the ID's we've actually launched as, instead of some passed environment variable.
|
||||||
|
PUID=$(id -u)
|
||||||
|
PGID=$(id -g)
|
||||||
|
|
||||||
files_ownership () {
|
files_ownership () {
|
||||||
# -h Changes the ownership of an encountered symbolic link and not that of the file or directory pointed to by the symbolic link.
|
# -h Changes the ownership of an encountered symbolic link and not that of the file or directory pointed to by the symbolic link.
|
||||||
|
@ -18,4 +20,11 @@ files_ownership
|
||||||
echo "==> Starting application with user $PUID group $PGID"
|
echo "==> Starting application with user $PUID group $PGID"
|
||||||
|
|
||||||
# --clear-groups Clear supplementary groups.
|
# --clear-groups Clear supplementary groups.
|
||||||
exec setpriv --reuid "$PUID" --regid "$PGID" --clear-groups "$@"
|
if [ $(id -u) -eq 0 ];
|
||||||
|
then
|
||||||
|
#We're running as root, so we can use setpriv without problems.
|
||||||
|
exec setpriv --reuid "$PUID" --regid "$PGID" --clear-groups "$@"
|
||||||
|
else
|
||||||
|
#We're running as a regular user, so we'll launch the app as one.
|
||||||
|
exec "$@"
|
||||||
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue