dianxin-guizhou-forward
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

59 linhas
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 --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