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

change unified to debian images (#2514)

* change to debian images

* add back sqlite connectionstring

* add back sqlite connection string

* Update docker-unified/entrypoint.sh

Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com>

* Update docker-unified/entrypoint.sh

Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com>

* update settings

* uid requires #

Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com>
This commit is contained in:
Kyle Spearrin 2023-01-05 09:27:28 -05:00 committed by GitHub
parent 3e07d0bd32
commit e800219d73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 32 deletions

View File

@ -1,13 +1,14 @@
############################################### ###############################################
# Build stage # # Build stage #
############################################### ###############################################
FROM --platform=$BUILDPLATFORM alpine AS web-setup FROM --platform=$BUILDPLATFORM debian AS web-setup
# Add packages # Add packages
RUN apk add --update-cache \ RUN apt-get update && apt-get install -y \
curl \ curl \
jq \ jq \
&& rm -rf /var/cache/apk/* unzip \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /tmp WORKDIR /tmp
@ -49,9 +50,6 @@ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
&& echo "RID=$RID" > /tmp/rid.txt && echo "RID=$RID" > /tmp/rid.txt
# Add packages # Add packages
# RUN apk add --update-cache \
# npm \
# && rm -rf /var/cache/apk/*
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
npm \ npm \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
@ -172,7 +170,7 @@ RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Scim --no-restore --no-s
############################################### ###############################################
# App stage # # App stage #
############################################### ###############################################
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine FROM mcr.microsoft.com/dotnet/aspnet:6.0
ARG TARGETPLATFORM ARG TARGETPLATFORM
LABEL com.bitwarden.product="bitwarden" LABEL com.bitwarden.product="bitwarden"
LABEL com.bitwarden.project="unified" LABEL com.bitwarden.project="unified"
@ -207,16 +205,15 @@ ENV globalSettings__logDirectoryByProject="false"
ENV globalSettings__logRollBySizeLimit="1073741824" ENV globalSettings__logRollBySizeLimit="1073741824"
# Add packages # Add packages
RUN apk add --update-cache \ RUN apt-get update && apt-get install -y \
curl \ curl \
icu-libs \
nginx \ nginx \
openssl \ openssl \
su-exec \
supervisor \ supervisor \
tzdata \ tzdata \
unzip \ unzip \
&& rm -rf /var/cache/apk/* sudo \
&& rm -rf /var/lib/apt/lists/*
# Create required directories # Create required directories
RUN mkdir -p /etc/bitwarden/attachments/send RUN mkdir -p /etc/bitwarden/attachments/send
@ -227,6 +224,9 @@ RUN mkdir -p /etc/supervisor
RUN mkdir -p /etc/supervisor.d RUN mkdir -p /etc/supervisor.d
RUN mkdir -p /var/log/bitwarden RUN mkdir -p /var/log/bitwarden
RUN mkdir -p /var/log/nginx/logs RUN mkdir -p /var/log/nginx/logs
RUN mkdir -p /etc/nginx/http.d
RUN mkdir -p /var/run/nginx
RUN touch /var/run/nginx/nginx.pid
RUN mkdir -p /app RUN mkdir -p /app
# Copy all apps from dotnet-build stage # Copy all apps from dotnet-build stage
@ -256,9 +256,9 @@ COPY docker-unified/hbs/app-id.hbs /etc/hbs/
COPY docker-unified/hbs/config.yaml /etc/hbs/ COPY docker-unified/hbs/config.yaml /etc/hbs/
# Download hbs tool for generating final configurations # Download hbs tool for generating final configurations
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ] ; then curl -L --output hbs.zip https://github.com/bitwarden/Handlebars.conf/releases/download/v1.3.0/hbs_alpine-x64_dotnet.zip; fi RUN if [ "$TARGETPLATFORM" = "linux/amd64" ] ; then curl -L --output hbs.zip https://github.com/bitwarden/Handlebars.conf/releases/download/v1.3.0/hbs_linux-x64_dotnet.zip; fi
RUN if [ "$TARGETPLATFORM" = "linux/arm/v7" ] ; then curl -L --output hbs.zip https://github.com/bitwarden/Handlebars.conf/releases/download/v1.3.0/hbs_alpine-armv7_dotnet.zip; fi RUN if [ "$TARGETPLATFORM" = "linux/arm/v7" ] ; then curl -L --output hbs.zip https://github.com/bitwarden/Handlebars.conf/releases/download/v1.3.0/hbs_linux-armv7_dotnet.zip; fi
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ] ; then curl -L --output hbs.zip https://github.com/bitwarden/Handlebars.conf/releases/download/v1.3.0/hbs_alpine-arm64_dotnet.zip; fi RUN if [ "$TARGETPLATFORM" = "linux/arm64" ] ; then curl -L --output hbs.zip https://github.com/bitwarden/Handlebars.conf/releases/download/v1.3.0/hbs_linux-arm64_dotnet.zip; fi
# Extract hbs # Extract hbs
RUN unzip hbs.zip -d /usr/local/bin && rm hbs.zip RUN unzip hbs.zip -d /usr/local/bin && rm hbs.zip
@ -268,11 +268,6 @@ RUN chmod +x /usr/local/bin/hbs
COPY docker-unified/entrypoint.sh /entrypoint.sh COPY docker-unified/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint.sh
# TODO: Remove after testing
RUN apk add --update-cache \
vim \
&& rm -rf /var/cache/apk/*
VOLUME ["/etc/bitwarden"] VOLUME ["/etc/bitwarden"]
WORKDIR /app WORKDIR /app

View File

@ -1,13 +1,12 @@
#!/bin/sh #!/bin/bash
# Set up user group # Set up user group
GID="${GID:-1000}" PGID="${PGID:-1000}"
addgroup -g $GID bitwarden addgroup --gid $PGID bitwarden
GROUP_NAME=$(cat /etc/group | grep ":$GID:" | cut -d ':' -f 1)
# Set up user # Set up user
UID="${UID:-1000}" PUID="${PUID:-1000}"
adduser -s /bin/false -D -u $UID -G $GROUP_NAME bitwarden adduser --no-create-home --shell /bin/bash --disabled-password --uid $PUID --gid $PGID --gecos "" bitwarden
# Translate environment variables for application settings # Translate environment variables for application settings
VAULT_SERVICE_URI=https://$BW_DOMAIN VAULT_SERVICE_URI=https://$BW_DOMAIN
@ -59,7 +58,7 @@ cp /etc/bitwarden/identity.pfx /app/Identity/identity.pfx
cp /etc/bitwarden/identity.pfx /app/Sso/identity.pfx cp /etc/bitwarden/identity.pfx /app/Sso/identity.pfx
# Generate SSL certificates # Generate SSL certificates
if [ "$BW_ENABLE_SSL" == "true" -a ! -f /etc/bitwarden/${BW_SSL_KEY:-ssl.key} ]; then if [ "$BW_ENABLE_SSL" = "true" -a ! -f /etc/bitwarden/${BW_SSL_KEY:-ssl.key} ]; then
openssl req \ openssl req \
-x509 \ -x509 \
-newkey rsa:4096 \ -newkey rsa:4096 \
@ -70,7 +69,7 @@ if [ "$BW_ENABLE_SSL" == "true" -a ! -f /etc/bitwarden/${BW_SSL_KEY:-ssl.key} ];
-out /etc/bitwarden/${BW_SSL_CERT:-ssl.crt} \ -out /etc/bitwarden/${BW_SSL_CERT:-ssl.crt} \
-reqexts SAN \ -reqexts SAN \
-extensions SAN \ -extensions SAN \
-config <(cat /etc/ssl/openssl.cnf <(printf "[SAN]\nsubjectAltName=DNS:${BW_DOMAIN:-localhost}\nbasicConstraints=CA:true")) \ -config <(cat /usr/lib/ssl/openssl.cnf <(printf "[SAN]\nsubjectAltName=DNS:${BW_DOMAIN:-localhost}\nbasicConstraints=CA:true")) \
-subj "/C=US/ST=California/L=Santa Barbara/O=Bitwarden Inc./OU=Bitwarden/CN=${BW_DOMAIN:-localhost}" -subj "/C=US/ST=California/L=Santa Barbara/O=Bitwarden Inc./OU=Bitwarden/CN=${BW_DOMAIN:-localhost}"
fi fi
@ -89,7 +88,7 @@ sed -i "s/autostart=true/autostart=${BW_ENABLE_NOTIFICATIONS}/" /etc/supervisor.
sed -i "s/autostart=true/autostart=${BW_ENABLE_SCIM}/" /etc/supervisor.d/scim.ini sed -i "s/autostart=true/autostart=${BW_ENABLE_SCIM}/" /etc/supervisor.d/scim.ini
sed -i "s/autostart=true/autostart=${BW_ENABLE_SSO}/" /etc/supervisor.d/sso.ini sed -i "s/autostart=true/autostart=${BW_ENABLE_SSO}/" /etc/supervisor.d/sso.ini
chown -R $UID:$GID \ chown -R $PUID:$PGID \
/app \ /app \
/etc/bitwarden \ /etc/bitwarden \
/etc/nginx/http.d \ /etc/nginx/http.d \
@ -97,6 +96,7 @@ chown -R $UID:$GID \
/etc/supervisor.d \ /etc/supervisor.d \
/var/lib/nginx \ /var/lib/nginx \
/var/log \ /var/log \
/var/run/nginx \
/run /run
su-exec $UID:$GID /usr/bin/supervisord sudo -E -u \#$PUID /usr/bin/supervisord

View File

@ -23,9 +23,9 @@ BW_INSTALLATION_KEY=xxxxxxxxxxxx
##################### #####################
# Learn more here: https://bitwarden.com/help/environment-variables/ # Learn more here: https://bitwarden.com/help/environment-variables/
# Container UID/GID # Container user ID/group ID
#UID=1000 #PUID=1000
#GID=1000 #PGID=1000
# Webserver ports # Webserver ports
#BW_PORT_HTTP=8080 #BW_PORT_HTTP=8080