#!/usr/bin/env bash
# 定义应用组名
group_name='zhongzheng'
# 定义应用名称
app_name='zhongzheng-api'
# 定义应用版本
app_version='1.0-SNAPSHOT'
# 定义应用环境
profile_active='prod'
echo '----copy jar----'
docker stop ${app_name}
echo '----stop container----'
docker rm ${app_name}
echo '----rm container----'
docker rmi ${group_name}/${app_name}:${app_version}
echo '----rm image----'
# 打包编译docker镜像
docker build -f /mydata/maven/build/Dockerfile -t ${group_name}/${app_name}:${app_version} .
echo '----build image----'
docker run -p 8089:8088 --name ${app_name} \
--restart=always \
-e 'spring.profiles.active'=${profile_active} \
-e TZ="Asia/Shanghai" \
-v /etc/localtime:/etc/localtime \
-v /mydata/app/${app_name}/logs:/var/logs \
-d ${group_name}/${app_name}:${app_version}
echo '----start container----'

echo "开始等待20秒..."
# 1-10秒内随机
sleep 5
echo "等待后继续"

#!/usr/bin/env bash
# 定义应用组名
group_name_two='zhongzheng_two'
# 定义应用名称
app_name_two='zhongzheng-api_two'
# 定义应用版本
app_version_two='1.0-SNAPSHOT'
# 定义应用环境
profile_active_two='prod'
echo '----copy jar----'
docker stop ${app_name_two}
echo '----stop container----'
docker rm ${app_name_two}
echo '----rm container----'
docker rmi ${group_name_two}/${app_name_two}:${app_version_two}
echo '----rm image----'
# 打包编译docker镜像
docker build -f /mydata/maven/build/Dockerfile -t ${group_name_two}/${app_name_two}:${app_version_two} .
echo '----build image----'
docker run -p 8090:8088 --name ${app_name_two} \
--restart=always \
-e 'spring.profiles.active'=${profile_active_two} \
-e TZ="Asia/Shanghai" \
-v /etc/localtime:/etc/localtime \
-v /mydata/app/${app_name_two}_two/logs:/var/logs \
-d ${group_name_two}/${app_name_two}:${app_version_two}
echo '----start container----'

#!/usr/bin/env bash
# 定义应用组名
group_admin_name='zhongzheng'
# 定义应用名称
app_admin_name='zhongzheng-admin'
# 定义应用版本
app_admin_version='1.0-SNAPSHOT'
# 定义应用环境
profile_active='prod'
echo '----copy jar admin----'
docker stop ${app_admin_name}
echo '----stop container admin----'
docker rm ${app_admin_name}
echo '----rm container admin----'
docker rmi ${group_admin_name}/${app_admin_name}:${app_admin_version}
echo '----rm image admin----'
# 打包编译docker镜像
docker build -f /mydata/maven/build/Dockerfile-admi -t ${group_admin_name}/${app_admin_name}:${app_admin_version} .
echo '----build image admin----'
docker run \
-p 9099:9099 \
--name ${app_admin_name} \
--restart=always \
-e 'spring.profiles.active'=${profile_active} \
-e TZ="Asia/Shanghai" \
-v /etc/localtime:/etc/localtime \
-v /mydata/app/${app_admin_name}/logs:/var/logs \
-d ${group_admin_name}/${app_admin_name}:${app_admin_version}
echo '----start container admin----'


echo "开始等待20秒..."
sleep 5
echo "等待后继续"

# 定义应用组名
group_admin_name_two='zhongzheng_two'
# 定义应用名称
app_admin_name_two='zhongzheng-admin_two'
# 定义应用版本
app_admin_version_two='1.0-SNAPSHOT'
# 定义应用环境
profile_active_two='prod'
echo '----copy jar admin----'
docker stop ${app_admin_name_two}
echo '----stop container admin----'
docker rm ${app_admin_name_two}
echo '----rm container admin----'
docker rmi ${group_admin_name_two}/${app_admin_name_two}:${app_admin_version_two}
echo '----rm image admin----'
# 打包编译docker镜像
docker build -f /mydata/maven/build/Dockerfile-admi -t ${group_admin_name_two}/${app_admin_name_two}:${app_admin_version_two} .
echo '----build image admin----'
docker run \
-p 10000:9099 \
--name ${app_admin_name_two} \
--restart=always \
-e 'spring.profiles.active'=${profile_active_two} \
-e TZ="Asia/Shanghai" \
-v /etc/localtime:/etc/localtime \
-v /mydata/app/${app_admin_name_two}/logs:/var/logs \
-d ${group_admin_name_two}/${app_admin_name_two}:${app_admin_version_two}
echo '----start container admin----'

#!/usr/bin/env bash
# 定义应用组名
group_saas_name='zhongzheng'
# 定义应用名称
app_saas_name='zhongzheng-admin-saas'
# 定义应用版本
app_saas_version='1.0-SNAPSHOT'
# 定义应用环境
profile_saas_active='prod'
echo '----copy jar saas----'
docker stop ${app_saas_name}
echo '----stop container saas----'
docker rm ${app_saas_name}
echo '----rm container saas----'
docker rmi ${group_saas_name}/${app_saas_name}:${app_version}
echo '----rm image saas----'
# 打包编译docker镜像
docker build -f /mydata/maven/build/Dockerfile-saas -t ${group_saas_name}/${app_saas_name}:${app_saas_version} .
echo '----build image saas----'
docker run -p 7077:7077 --name ${app_saas_name} \
--restart=always \
-e 'spring.profiles.active'=${profile_saas_active} \
-e TZ="Asia/Shanghai" \
-v /etc/localtime:/etc/localtime \
-v /mydata/app/${app_saas_name}/logs:/var/logs \
-d ${group_saas_name}/${app_name}:${app_saas_version}


