Fixes #603 by not recreating existing unix groups and users
This commit is contained in:
parent
9ca1382cf1
commit
8c14087a2c
@ -1,4 +1,4 @@
|
||||
FROM lukechannings/deno:v1.38.5
|
||||
FROM lukechannings/deno:v1.39.0
|
||||
# The volume that will keep the space data
|
||||
|
||||
# Either create a volume:
|
||||
@ -17,7 +17,7 @@ ENV TINI_VERSION v0.19.0
|
||||
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini
|
||||
|
||||
# Make sure the deno user has access to the space volume
|
||||
RUN mkdir -p -m 770 /space \
|
||||
RUN mkdir -p -m 777 /space \
|
||||
&& chmod +x /tini \
|
||||
&& apt update \
|
||||
&& apt install -y git ssh-client \
|
||||
|
@ -16,12 +16,14 @@ 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
|
||||
getent group silverbullet &> /dev/null || groupadd -g $PGID silverbullet
|
||||
id -u silverbullet &> /dev/null || useradd -M -u $PUID -g $PGID silverbullet
|
||||
getent group $PGID &> /dev/null || groupadd -g $PGID silverbullet
|
||||
getent passwd $PUID &> /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
|
||||
args="$@"
|
||||
su silverbullet -s /bin/bash -c "deno run -A --unstable /silverbullet.js $args"
|
||||
# And run via su as requested PUID, usually this will be 'silverbullet' but if a user with this idea already exists, we will use that
|
||||
USERNAME=$(getent passwd $PUID | cut -d ":" -f 1)
|
||||
echo "Running SilverBullet as $USERNAME (configured as PUID $PUID and PGID $PGID)"
|
||||
su $USERNAME -s /bin/bash -c "deno run -A --unstable /silverbullet.js $args"
|
||||
fi
|
||||
|
||||
|
@ -28,7 +28,7 @@ export async function determineDatabaseBackend(
|
||||
}
|
||||
const denoDb = await Deno.openKv(dbFile);
|
||||
console.info(
|
||||
`Using DenoKV as a database backend (${dbFile || "cloud"}.`,
|
||||
`Using DenoKV as a database backend (${dbFile || "cloud"}).`,
|
||||
);
|
||||
return new DenoKvPrimitives(denoDb);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user