diff --git a/src/EventsProcessor/Dockerfile b/src/EventsProcessor/Dockerfile new file mode 100644 index 0000000000..4eaa6c155d --- /dev/null +++ b/src/EventsProcessor/Dockerfile @@ -0,0 +1,20 @@ +FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 + +LABEL com.bitwarden.product="bitwarden" + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + gosu \ + curl \ + && rm -rf /var/lib/apt/lists/* + +ENV ASPNETCORE_URLS http://+:5000 +WORKDIR /app +EXPOSE 5000 +COPY obj/Docker/publish . +COPY entrypoint.sh / +RUN chmod +x /entrypoint.sh + +HEALTHCHECK CMD curl -f http://localhost:5000/alive || exit 1 + +CMD ["./../entrypoint.sh"] diff --git a/src/EventsProcessor/build.sh b/src/EventsProcessor/build.sh old mode 100644 new mode 100755 index afdc090d80..a684b6e028 --- a/src/EventsProcessor/build.sh +++ b/src/EventsProcessor/build.sh @@ -18,5 +18,5 @@ if [ "$1" != "nodocker" ] then echo -e "\nBuilding docker image" docker --version - docker build -t bitwarden/icons "$DIR/." + docker build -t bitwarden/event-processor:rc "$DIR/." fi diff --git a/src/EventsProcessor/entrypoint.sh b/src/EventsProcessor/entrypoint.sh new file mode 100644 index 0000000000..814fcd19f4 --- /dev/null +++ b/src/EventsProcessor/entrypoint.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Setup + +GROUPNAME="bitwarden" +USERNAME="bitwarden" + +LUID=${LOCAL_UID:-0} +LGID=${LOCAL_GID:-0} + +# Step down from host root to well-known nobody/nogroup user + +if [ $LUID -eq 0 ] +then + LUID=65534 +fi +if [ $LGID -eq 0 ] +then + LGID=65534 +fi + +# Create user and group + +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 /app +mkdir -p /etc/bitwarden/logs +#mkdir -p /etc/bitwarden/ca-certificates +chown -R $USERNAME:$GROUPNAME /etc/bitwarden + +#cp /etc/bitwarden/ca-certificates/*.crt /usr/local/share/ca-certificates/ >/dev/null 2>&1 \ +# && update-ca-certificates + +exec gosu $USERNAME:$GROUPNAME dotnet /app/EventsProcessor.dll