From d74c71c1d0cb8ed7269faf6db4bee8cbd4939563 Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Wed, 6 Aug 2025 18:44:01 +0000 Subject: [PATCH] Fix attachments container (#6165) --- util/Attachments/Dockerfile | 4 ++-- util/Attachments/entrypoint.sh | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) 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=""