diff --git a/util/Attachments/Dockerfile b/util/Attachments/Dockerfile index 4ab1d0c11b..5ba22918c4 100644 --- a/util/Attachments/Dockerfile +++ b/util/Attachments/Dockerfile @@ -26,7 +26,6 @@ WORKDIR /source/util/Server RUN . /tmp/rid.txt && dotnet restore -r $RID # Build project -WORKDIR /source/util/Server RUN . /tmp/rid.txt && dotnet publish \ -c release \ --no-restore \ @@ -48,7 +47,8 @@ ENV SSL_CERT_DIR=/etc/bitwarden/ca-certificates ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false EXPOSE 5000 -RUN apk add --no-cache curl \ +RUN apk add --no-cache \ + curl \ icu-libs \ shadow \ && apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community gosu diff --git a/util/Attachments/entrypoint.sh b/util/Attachments/entrypoint.sh index 2c0942a148..0b5deaae2b 100644 --- a/util/Attachments/entrypoint.sh +++ b/util/Attachments/entrypoint.sh @@ -23,17 +23,17 @@ if [ "$(id -u)" = "0" ] then # Create user and group - addgroup -g "$LGID" -S "$GROUPNAME" 2>/dev/null || true - adduser -u "$LUID" -G "$GROUPNAME" -S -D -H "$USERNAME" 2>/dev/null || true - mkdir -p /home/$USERNAME - chown $USERNAME:$GROUPNAME /home/$USERNAME - + groupadd -o -g $LGID $GROUPNAME >/dev/null 2>&1 || + groupmod -o -g $LGID $GROUPNAME >/dev/null 2>&1 + useradd -o -u $LUID -g $GROUPNAME -s /bin/false $USERNAME >/dev/null 2>&1 || + usermod -o -u $LUID -g $GROUPNAME -s /bin/false $USERNAME >/dev/null 2>&1 + mkhomedir_helper $USERNAME # The rest... - chown -R $USERNAME:$GROUPNAME /bitwarden_server mkdir -p /etc/bitwarden/core/attachments chown -R $USERNAME:$GROUPNAME /etc/bitwarden + gosu_cmd="gosu $USERNAME:$GROUPNAME" else gosu_cmd=""