Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

29 lignes
1.7KB

  1. #!/bin/bash
  2. environment=$1
  3. version=$2
  4. echo "环境变量为${environment},版本为$version!"
  5. if [[ ${environment} == 'production' ]]; then
  6. echo "开始远程构建容器"
  7. docker stop gps_gateway_position || true
  8. docker rm gps_gateway_position || true
  9. docker rmi -f $(docker images | grep registry.cn-shanghai.aliyuncs.com/gps_card/gps_gateway_position | awk '{print $3}')
  10. #docker login --username=telpo_linwl@1111649216405698 --password=telpo#1234 registry.cn-shanghai.aliyuncs.com
  11. docker login --username=rzl_wangjx@1111649216405698 --password=telpo.123 registry.cn-shanghai.aliyuncs.com
  12. docker pull registry.cn-shanghai.aliyuncs.com/gps_card/gps_gateway_position:$version
  13. docker run --network=host -d -v /home/data/gps_gateway_position/log:/var/gateway/logs --restart=always -e environment=production --name gps_gateway_position registry.cn-shanghai.aliyuncs.com/gps_card/gps_gateway_position:$version ;
  14. #删除产生的None镜像
  15. docker rmi -f $(docker images | grep none | awk '{print $3}')
  16. docker ps -a
  17. elif [[ ${environment} == 'test' || ${environment} == 'presure' ]]; then
  18. echo "开始在测试环境远程构建容器"
  19. docker stop gps_gateway_position || true
  20. docker rm gps_gateway_position || true
  21. docker rmi -f $(docker images | grep 139.224.254.18:5000/gps_gateway_position | awk '{print $3}')
  22. docker pull 139.224.254.18:5000/gps_gateway_position:$version
  23. docker run --network=host -d -v /home/data/gps_gateway_position/log:/var/gateway/logs --restart=always -e environment=${environment} --name gps_gateway_position 139.224.254.18:5000/gps_gateway_position:$version;
  24. #删除产生的None镜像
  25. docker rmi -f $(docker images | grep none | awk '{print $3}')
  26. docker ps -a
  27. fi