Jenkins-docker-svn 自动化部署 2018-1

2018-12-04  本文已影响0人  飘向未来
安装 这个插件可以   new a maven project   


image_version=`date +%Y%m%d%H%M`;

docker tag yourself/spring-boot-demo:latest yourself/spring-boot-demo:$image_version

mvn clean package docker:build

if docker ps | grep -i sbdemo; then

docker stop sbdemo

fi

if docker ps -a | grep -i sbdemo; then

docker rm sbdemo

fi

docker run --name sbdemo -v /home/yourself:/logs -dit -p 8004:8004 yourself/spring-boot-demo

下面奉上脚本

推送镜像脚本
docker tag yourself/spring-boot-demo ip:5000/yourself/spring-boot-demo

docker push ip:5000/yourself/spring-boot-demo

curl ip:5000/v2/_catalog

拉取并运行镜像

if docker ps | grep -i sbdemo ; then

docker stop sbdemo

fi

if docker ps -a | grep -i sbdemo ; then

docker rm sbdemo

fi

if docker images | grep -i ip:5000/yourself/spring-boot-demo ; then

docker rmi ip:5000/yourself/spring-boot-demo

fi

docker pull ip:5000/yourself/spring-boot-demo

docker run --name sbdemo -v /home/yourself:/logs -dit -p 8004:8004 ip:5000/yourself/spring-boot-demo

上一篇下一篇

猜你喜欢

热点阅读