23 lines
699 B
Bash
23 lines
699 B
Bash
#!/bin/sh
|
||
# 定义应用组名
|
||
group_name='karl'
|
||
# 定义应用名称 ,这里的name是获取你仓库的名称,也可以自己写
|
||
app_name=${DRONE_REPO_NAME}
|
||
# 定义应用版本
|
||
app_version='latest'
|
||
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 -t ${group_name}/${app_name}:${app_version} .
|
||
echo '----build image----'
|
||
docker run -p 9090:9090 --name ${app_name} \
|
||
-e TZ="Asia/Shanghai" \
|
||
-v /etc/localtime:/etc/localtime \
|
||
-d ${group_name}/${app_name}:${app_version}
|
||
echo '----start container----'
|