#!/usr/bin/env bash
# 定义应用组名
group_name='zhongzheng'
# 定义应用名称
app_name='zhongzheng-saas-api'
# 定义应用版本
app_version='1.0-SNAPSHOT'
# 定义应用环境
profile_active='dev'
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 5055:5055 --name ${app_name} \
--restart=always \
--link mysql:db \
-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_admin_name='zhongzheng'
# 定义应用名称
app_admin_name='zhongzheng-saas-admin'
# 定义应用版本
app_admin_version='1.0-SNAPSHOT'
# 定义应用环境
profile_active='dev'
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 5030:5030 \
--name ${app_admin_name} \
--restart=always \
--link mysql:db \
-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秒..."
# 1-10秒内随机
sleep 25
echo "等待后继续"

# 定义应用组名
group_admin_name_two='zhongzheng_saas_two'
# 定义应用名称
app_admin_name_two='zhongzheng-saas-admin_two'
# 定义应用版本
app_admin_version_two='1.0-SNAPSHOT'
# 定义应用环境
profile_active_two='dev'
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 5031:5030 \
--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----'




