1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +01:00

build and include notifications docker

This commit is contained in:
Kyle Spearrin 2018-08-17 18:14:25 -04:00
parent 5766c1f6f3
commit ca3ecc0163
9 changed files with 110 additions and 1 deletions

View File

@ -17,6 +17,7 @@ then
docker push bitwarden/server:$TAG
docker push bitwarden/attachments:$TAG
docker push bitwarden/icons:$TAG
docker push bitwarden/notifications:$TAG
docker push bitwarden/admin:$TAG
docker push bitwarden/nginx:$TAG
docker push bitwarden/mssql:$TAG
@ -32,6 +33,7 @@ then
docker tag bitwarden/server bitwarden/server:$TAG
docker tag bitwarden/attachments bitwarden/attachments:$TAG
docker tag bitwarden/icons bitwarden/icons:$TAG
docker tag bitwarden/notifications bitwarden/notifications:$TAG
docker tag bitwarden/admin bitwarden/admin:$TAG
docker tag bitwarden/nginx bitwarden/nginx:$TAG
docker tag bitwarden/mssql bitwarden/mssql:$TAG
@ -58,6 +60,9 @@ else
chmod u+x $DIR/src/Icons/build.sh
$DIR/src/Icons/build.sh
chmod u+x $DIR/src/Notifications/build.sh
$DIR/src/Notifications/build.sh
chmod u+x $DIR/src/Admin/build.sh
$DIR/src/Admin/build.sh

View File

@ -2,4 +2,3 @@
!obj/Docker/publish/*
!obj/Docker/empty/
!entrypoint.sh
!iconserver.sha256

View File

@ -30,5 +30,11 @@ 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/Icons.dll

View File

@ -0,0 +1,4 @@
*
!obj/Docker/publish/*
!obj/Docker/empty/
!entrypoint.sh

View File

@ -0,0 +1,17 @@
FROM microsoft/dotnet:2.1.2-aspnetcore-runtime
LABEL com.bitwarden.product="bitwarden"
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
gosu \
&& 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
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo -e "\n## Building Notifications"
echo -e "\nBuilding app"
echo ".NET Core version $(dotnet --version)"
echo "Restore"
dotnet restore $DIR/Notifications.csproj
echo "Clean"
dotnet clean $DIR/Notifications.csproj -c "Release" -o $DIR/obj/Docker/publish
echo "Publish"
dotnet publish $DIR/Notifications.csproj -c "Release" -o $DIR/obj/Docker/publish
echo -e "\nBuilding docker image"
docker --version
docker build -t bitwarden/notifications $DIR/.

View File

@ -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/Notifications.dll

View File

@ -186,9 +186,24 @@ services:
image: bitwarden/icons:{CoreVersion}
container_name: bitwarden-icons
restart: always
volumes:
- ../ca-certificates:/etc/bitwarden/ca-certificates
- ../logs/icons:/etc/bitwarden/logs
env_file:
- ../env/uid.env
notifications:
image: bitwarden/notifications:{CoreVersion}
container_name: bitwarden-notifications
restart: always
volumes:
- ../ca-certificates:/etc/bitwarden/ca-certificates
- ../logs/notifications:/etc/bitwarden/logs
env_file:
- global.env
- ../env/uid.env
- ../env/global.override.env
nginx:
image: bitwarden/nginx:{CoreVersion}
container_name: bitwarden-nginx

View File

@ -172,6 +172,10 @@ server {{
proxy_pass http://icons:5000/;
}}
location /notifications/ {{
proxy_pass http://notifications:5000/;
}}
location /admin {{
proxy_pass http://admin:5000;
}}