dianxin-guizhou-forward
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

60 lines
3.0KB

  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
  34. --name gd202101_service 139.224.254.18:5000/gd202101_service:$version
  35. #删除产生的None镜像
  36. docker rmi -f $(docker images | grep none | awk '{print $3}')
  37. docker ps -a
  38. fi
  39. if [[ ${environment} == 'test' ]]; then
  40. #echo "开始远程构建容器"
  41. docker stop gd202101_service || true
  42. docker rm gd202101_service || true
  43. docker rmi -f $(docker images | grep 139.224.254.18:5000/gd202101_service | awk '{print $3}')
  44. docker pull 139.224.254.18:5000/gd202101_service:$version
  45. 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
  46. #删除产生的None镜像
  47. docker rmi -f $(docker images | grep none | awk '{print $3}')
  48. docker ps -a
  49. fi
  50. if [[ ${environment} == 'dev' ]]; then
  51. docker stop gd202101_service || true
  52. docker rm gd202101_service || true
  53. docker rmi -f $(docker images | grep 139.224.254.18:5000/gd202101_service | awk '{print $3}')
  54. docker pull 139.224.254.18:5000/gd202101_service:$version
  55. 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
  56. #删除产生的None镜像
  57. docker rmi -f $(docker images | grep none | awk '{print $3}')
  58. docker ps -a
  59. fi