dianxin-guizhou-forward
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

guizhou_dianxin_202101_run.sh 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/bash
  2. environment=$1
  3. version=$2
  4. echo "环境变量为${environment},版本为$version!"
  5. if [[ ${environment} == 'pro1' ]]; then
  6. #echo "开始远程构建容器"
  7. docker stop gd202101_service || true
  8. docker rm gd202101_service || true
  9. docker rmi -f $(docker images | grep 139.224.254.18:5000/gd202101_service | awk '{print $3}')
  10. docker pull 139.224.254.18:5000/gd202101_service:$version
  11. docker run -v /home/data/gd202101server/log:/var/log/gd202101server -e active=pro1 --restart=always -d --network host --name gd202101_service 139.224.254.18:5000/gd202101_service:$version
  12. #删除产生的None镜像
  13. docker rmi -f $(docker images | grep none | awk '{print $3}')
  14. docker ps -a
  15. fi
  16. if [[ ${environment} == 'pro2' ]]; then
  17. #echo "开始远程构建容器"
  18. docker stop gd202101_service || true
  19. docker rm gd202101_service || true
  20. docker rmi -f $(docker images | grep 139.224.254.18:5000/gd202101_service | awk '{print $3}')
  21. docker pull 139.224.254.18:5000/gd202101_service:$version
  22. docker run -v /home/data/gd202101server/log:/var/log/gd202101server -e active=pro2 --restart=always -d --network host --name gd202101_service 139.224.254.18:5000/gd202101_service:$version
  23. #删除产生的None镜像
  24. docker rmi -f $(docker images | grep none | awk '{print $3}')
  25. docker ps -a
  26. fi
  27. if [[ ${environment} == 'pro3' ]]; then
  28. #echo "开始远程构建容器"
  29. docker stop gd202101_service || true
  30. docker rm gd202101_service || true
  31. docker rmi -f $(docker images | grep 139.224.254.18:5000/gd202101_service | awk '{print $3}')
  32. docker pull 139.224.254.18:5000/gd202101_service:$version
  33. docker run -v /home/data/gd202101server/log:/var/log/gd202101server -e active=pro3 --restart=always -d --network host --name gd202101_service 139.224.254.18:5000/gd202101_service:$version
  34. #删除产生的None镜像
  35. docker rmi -f $(docker images | grep none | awk '{print $3}')
  36. docker ps -a
  37. fi
  38. if [[ ${environment} == 'test' ]]; then
  39. #echo "开始远程构建容器"
  40. docker stop gd202101_service || true
  41. docker rm gd202101_service || true
  42. docker rmi -f $(docker images | grep 139.224.254.18:5000/gd202101_service | awk '{print $3}')
  43. docker pull 139.224.254.18:5000/gd202101_service:$version
  44. docker run -v /home/data/gd202101server/log:/var/log/gd202101server -e active=test --restart=always -d --network host --name gd202101_service 139.224.254.18:5000/gd202101_service:$version
  45. #删除产生的None镜像
  46. docker rmi -f $(docker images | grep none | awk '{print $3}')
  47. docker ps -a
  48. fi
  49. if [[ ${environment} == 'dev' ]]; then
  50. docker stop gd202101_service || true
  51. docker rm gd202101_service || true
  52. docker rmi -f $(docker images | grep 139.224.254.18:5000/gd202101_service | awk '{print $3}')
  53. docker pull 139.224.254.18:5000/gd202101_service:$version
  54. docker run -v /home/data/gd202101server/log:/var/log/gd202101server -e active=dev --restart=always -d --network host --name gd202101_service telpo/gd202101_service:$version
  55. #删除产生的None镜像
  56. docker rmi -f $(docker images | grep none | awk '{print $3}')
  57. docker ps -a
  58. fi