2021-10-08 18:53:56 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
##############################
|
|
|
|
# Builds the docker image from a pre-built build directory
|
|
|
|
# Arguments:
|
|
|
|
# 1: Project Name
|
|
|
|
# 2: Project Directory
|
|
|
|
# 3: Docker Tag
|
|
|
|
# 4: Docker push
|
|
|
|
# Outputs:
|
|
|
|
# Output to STDOUT or STDERR.
|
|
|
|
# Returns:
|
|
|
|
# Returned values other than the default exit status of the last command run.
|
|
|
|
##############################
|
|
|
|
docker_build() {
|
|
|
|
local project_name=$1
|
|
|
|
local project_dir=$2
|
|
|
|
local docker_tag=$3
|
|
|
|
local docker_push=$4
|
|
|
|
|
|
|
|
local project_name_lower=$(echo "$project_name" | awk '{print tolower($0)}')
|
|
|
|
|
|
|
|
echo "Building docker image: bitwarden/$project_name_lower:$docker_tag"
|
|
|
|
echo "=============================="
|
|
|
|
docker build -t bitwarden/$project_name_lower:$docker_tag $project_dir
|
|
|
|
|
|
|
|
if [ "$docker_push" == "1" ]; then
|
2023-06-29 15:23:25 +02:00
|
|
|
docker push bitwarden/$project_name_lower:$docker_tag
|
2021-10-08 18:53:56 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Get Project
|
|
|
|
PROJECT=$1; shift
|
|
|
|
|
|
|
|
# Get Params
|
|
|
|
TAG="latest"
|
|
|
|
PUSH=0
|
|
|
|
|
|
|
|
while [ ! $# -eq 0 ]; do
|
|
|
|
case "$1" in
|
|
|
|
-t | --tag)
|
|
|
|
if [[ $2 ]]; then
|
|
|
|
TAG="$2"
|
|
|
|
shift
|
|
|
|
else
|
|
|
|
exp "--tag requires a value"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
--push) PUSH=1 ;;
|
|
|
|
-h | --help ) usage && exit ;;
|
|
|
|
*) usage && exit ;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
case "$PROJECT" in
|
|
|
|
"admin" | "Admin") docker_build Admin $PWD/src/Admin $TAG $PUSH ;;
|
2022-11-18 20:39:01 +01:00
|
|
|
"api" | "Api") docker_build Api $PWD/src/Api $TAG $PUSH ;;
|
2021-12-07 19:30:18 +01:00
|
|
|
"attachments" | "Attachments") docker_build Attachments $PWD/util/Attachments $TAG $PUSH ;;
|
2022-11-18 20:39:01 +01:00
|
|
|
#"billing" | "Billing") docker_build Billing $PWD/src/Billing $TAG $PUSH ;;
|
|
|
|
"events" | "Events") docker_build Events $PWD/src/Events $TAG $PUSH ;;
|
|
|
|
"eventsprocessor" | "EventsProcessor") docker_build EventsProcessor $PWD/src/EventsProcessor $TAG $PUSH ;;
|
2021-10-08 18:53:56 +02:00
|
|
|
"icons" | "Icons") docker_build Icons $PWD/src/Icons $TAG $PUSH ;;
|
2022-11-18 20:39:01 +01:00
|
|
|
"identity" | "Identity") docker_build Identity $PWD/src/Identity $TAG $PUSH ;;
|
2021-10-08 18:53:56 +02:00
|
|
|
"mssql" | "MsSql" | "Mssql") docker_build MsSql $PWD/util/MsSql $TAG $PUSH ;;
|
2022-11-18 20:39:01 +01:00
|
|
|
"nginx" | "Nginx") docker_build Nginx $PWD/util/Nginx $TAG $PUSH ;;
|
|
|
|
"notifications" | "Notifications") docker_build Notifications $PWD/src/Notifications $TAG $PUSH ;;
|
|
|
|
"server" | "Server") docker_build Server $PWD/util/Server $TAG $PUSH ;;
|
2021-12-07 19:30:18 +01:00
|
|
|
"setup" | "Setup") docker_build Setup $PWD/util/Setup $TAG $PUSH ;;
|
2022-11-18 20:39:01 +01:00
|
|
|
"sso" | "Sso") docker_build Sso $PWD/bitwarden_license/src/Sso $TAG $PUSH ;;
|
2021-10-08 18:53:56 +02:00
|
|
|
"")
|
|
|
|
docker_build Admin $PWD/src/Admin $TAG $PUSH
|
2022-11-18 20:39:01 +01:00
|
|
|
docker_build Api $PWD/src/Api $TAG $PUSH
|
2021-12-07 19:30:18 +01:00
|
|
|
docker_build Attachments $PWD/util/Attachments $TAG $PUSH
|
2022-11-18 20:39:01 +01:00
|
|
|
#docker_build Billing $PWD/src/Billing $TAG $PUSH
|
|
|
|
docker_build Events $PWD/src/Events $TAG $PUSH
|
|
|
|
docker_build EventsProcessor $PWD/src/EventsProcessor $TAG $PUSH
|
2021-10-08 18:53:56 +02:00
|
|
|
docker_build Icons $PWD/src/Icons $TAG $PUSH
|
2022-11-18 20:39:01 +01:00
|
|
|
docker_build Identity $PWD/src/Identity $TAG $PUSH
|
2021-12-14 16:59:56 +01:00
|
|
|
docker_build MsSql $PWD/util/MsSql $TAG $PUSH
|
2022-11-18 20:39:01 +01:00
|
|
|
docker_build Nginx $PWD/util/Nginx $TAG $PUSH
|
|
|
|
docker_build Notifications $PWD/src/Notifications $TAG $PUSH
|
|
|
|
docker_build Server $PWD/util/Server $TAG $PUSH
|
2021-10-08 18:53:56 +02:00
|
|
|
docker_build Setup $PWD/util/Setup $TAG $PUSH
|
2022-11-18 20:39:01 +01:00
|
|
|
docker_build Sso $PWD/bitwarden_license/src/Sso $TAG $PUSH
|
2021-10-08 18:53:56 +02:00
|
|
|
;;
|
|
|
|
esac
|