1
0

Docker: Only create user/group when don't already exist

This commit is contained in:
Zef Hemel 2023-11-30 15:12:16 +01:00
parent 1d5c6f9277
commit 2430a4f012

View File

@ -16,8 +16,8 @@ if [ "$PUID" == "0" ] || [ "$UID" != "0" ]; then
deno run -A --unstable /silverbullet.js $@
else
# Create silverbullet user and group ad-hoc mapped to PUID and PGID
groupadd -g $PGID silverbullet
useradd -M -u $PUID -g $PGID silverbullet
getent group silverbullet || groupadd -g $PGID silverbullet
id -u silverbullet &> /dev/null || useradd -M -u $PUID -g $PGID silverbullet
# And make sure /deno-dir (Deno cache) is accessible
chown -R $PUID:$PGID /deno-dir
# And run via su as the newly mapped 'silverbullet' user