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ů.

27 lines
1.5KB

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