diff --git a/services/Dockerfile-bitwarden b/services/bitwarden/Dockerfile-bitwarden-app similarity index 100% rename from services/Dockerfile-bitwarden rename to services/bitwarden/Dockerfile-bitwarden-app diff --git a/services/Dockerfile-bitwarden-db b/services/bitwarden/Dockerfile-bitwarden-db similarity index 100% rename from services/Dockerfile-bitwarden-db rename to services/bitwarden/Dockerfile-bitwarden-db diff --git a/services/bitwarden/build.sh b/services/bitwarden/build.sh new file mode 100644 index 0000000..59dd88f --- /dev/null +++ b/services/bitwarden/build.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +source constants.sh + +docker build -t $DB_IMAGE_NAME:dev -f Dockerfile-bitwarden-db . +docker build -t $APP_IMAGE_NAME:dev -f Dockerfile-bitwarden-app . diff --git a/services/bitwarden/constants.sh b/services/bitwarden/constants.sh new file mode 100644 index 0000000..2df6d9c --- /dev/null +++ b/services/bitwarden/constants.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +export APP_NAME="bitwarden" +export APP_CONTAINER_NAME=$APP_NAME-app +export APP_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$APP_CONTAINER_NAME +export DB_CONTAINER_NAME=$APP_NAME-db +export DB_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$DB_CONTAINER_NAME +export NETWORK_NAME=$APP_NAME-local diff --git a/services/bitwarden/start.sh b/services/bitwarden/start.sh new file mode 100644 index 0000000..a281880 --- /dev/null +++ b/services/bitwarden/start.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +source constants.sh + +docker network create $NETWORK_NAME || echo "Network $NETWORK_NAME already exists" + +docker run \ + --detach \ + --network $NETWORK_NAME \ + --name $DB_CONTAINER_NAME \ + --env-file $ENV_FILE_DIR/bitwarden-db.env \ + --mount type=bind,source=$APP_DATA_DIR/bitwarden/db,target=/var/lib/mysql \ + $DB_IMAGE_NAME:dev + +docker run \ + --detach \ + --network $NETWORK_NAME \ + --name $APP_CONTAINER_NAME \ + --env-file $ENV_FILE_DIR/bitwarden-web.env \ + --publish 8080:8080 \ + --mount type=bind,source=$APP_DATA_DIR/bitwarden/config,target=/etc/bitwarden \ + --mount type=bind,source=$APP_DATA_DIR/bitwarden/logs,target=/var/log/bitwarden \ + $APP_IMAGE_NAME:dev diff --git a/services/bitwarden/stop.sh b/services/bitwarden/stop.sh new file mode 100644 index 0000000..62c5c50 --- /dev/null +++ b/services/bitwarden/stop.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +source constants.sh + +docker rm -f $APP_CONTAINER_NAME +docker rm -f $DB_CONTAINER_NAME