Make docker work with --user flag
This commit is contained in:
parent
48986fc6cb
commit
4ba6966aa2
@ -17,13 +17,15 @@ ENV TINI_VERSION v0.19.0
|
|||||||
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini
|
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini
|
||||||
|
|
||||||
# Make sure the deno user has access to the space volume
|
# Make sure the deno user has access to the space volume
|
||||||
RUN mkdir -p /space \
|
RUN mkdir -p -m 770 /space \
|
||||||
&& chmod +x /tini \
|
&& chmod +x /tini \
|
||||||
&& apt update \
|
&& apt update \
|
||||||
&& apt install -y git ssh-client \
|
&& apt install -y git ssh-client \
|
||||||
&& echo "**** cleanup ****" \
|
&& echo "**** cleanup ****" \
|
||||||
&& apt-get -y autoremove \
|
&& apt-get -y autoremove \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
|
&& mkdir -p /deno-dir \
|
||||||
|
&& chmod 777 /deno-dir \
|
||||||
&& rm -rf \
|
&& rm -rf \
|
||||||
/tmp/* \
|
/tmp/* \
|
||||||
/var/lib/apt/lists/* \
|
/var/lib/apt/lists/* \
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
# Check if UID and GID are passed as environment variables, if not, extract from the space folder owner
|
# Check if UID and GID are passed as environment variables, if not, extract from the space folder owner
|
||||||
if [ -z "$PUID" ]; then
|
if [ -z "$PUID" ] && [ "$UID" == "0" ] ; then
|
||||||
# Get the UID of the folder owner
|
# Get the UID of the folder owner
|
||||||
PUID=$(stat -c "%u" "$SB_FOLDER")
|
PUID=$(stat -c "%u" "$SB_FOLDER")
|
||||||
echo "Will run SilverBullet with UID $PUID, inferred from the owner of $SB_FOLDER (set PUID environment variable to override)"
|
echo "Will run SilverBullet with UID $PUID, inferred from the owner of $SB_FOLDER (set PUID environment variable to override)"
|
||||||
@ -11,8 +11,8 @@ if [ -z "$PGID" ]; then
|
|||||||
PGID=$(stat -c "%g" "$SB_FOLDER")
|
PGID=$(stat -c "%g" "$SB_FOLDER")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$PUID" -eq "0" ]; then
|
if [ "$PUID" == "0" ] || [ "$UID" != "0" ]; then
|
||||||
echo "Will run SilverBullet as root"
|
# Will run SilverBullet as default user
|
||||||
deno run -A --unstable /silverbullet.js $@
|
deno run -A --unstable /silverbullet.js $@
|
||||||
else
|
else
|
||||||
# Create silverbullet user and group ad-hoc mapped to PUID and PGID
|
# Create silverbullet user and group ad-hoc mapped to PUID and PGID
|
||||||
|
Loading…
Reference in New Issue
Block a user