spring boot docker打包部署运行

#!/bin/bash
git_work='csy-gitlab';
git_url='oauth2:1_tjyy7swuezbhrVFZ4K@ip/devops/csy-gitlab.git';
branch='dev';
docker_api='ip:4243';
docker_imag='devops-cloud/csy-gitlab:1.0';
docker_cont='csy-gitlab';
apply_port='8010:8010';
ip='172.22.0.6';
if [ ! -d $git_work ];
then 
  find . -name ".git" | xargs rm -Rf;
  sudo git init && sudo git clone -b $branch http://$git_url
else
  echo 'haved file';
fi
cd $git_work;
sudo git pull;
sudo mvn clean install;
sudo docker -H $docker_api rm -f /$docker_cont || echo 'erro:docker rm -f'
sudo docker -H $docker_api rmi -f $docker_imag || echo 'erro:docker rmi -f'
sudo docker -H $docker_api build -t $docker_imag .
sudo docker -H $docker_api run -d --restart always --net mynetwork -p $apply_port --ip $ip --name $docker_cont $docker_imag 
sudo docker -H $docker_api restart  $docker_cont

 

你可能感兴趣的:(部署)