Files
sponge/scripts/deploy-docker.sh
2023-09-02 22:18:32 +08:00

33 lines
767 B
Bash

#!/bin/bash
dockerComposeFilePath="deployments/docker-compose"
function checkResult() {
result=$1
if [ ${result} -ne 0 ]; then
exit ${result}
fi
}
mkdir -p ${dockerComposeFilePath}/configs
if [ ! -f "${dockerComposeFilePath}/configs/serverNameExample.yml" ];then
cp configs/serverNameExample.yml ${dockerComposeFilePath}/configs
fi
# shellcheck disable=SC2164
cd ${dockerComposeFilePath}
docker-compose down
checkResult $?
docker-compose up -d
checkResult $?
colorCyan='\e[1;36m'
highBright='\e[1m'
markEnd='\e[0m'
echo ""
echo -e "run service successfully, if you want to stop the service, go into the ${highBright}${dockerComposeFilePath}${markEnd} directory and execute the command ${colorCyan}docker-compose down${markEnd}."
echo ""