万佳安设备数据
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.

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_wanjiaan || true
  8. docker rm telpo_push_wanjiaan || true
  9. docker rmi -f $(docker images | grep registry.cn-shanghai.aliyuncs.com/gps_card/telpo_push_wanjiaan | 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_wanjiaan:$version
  12. docker run -d --network=host -e environment=production -v /home/data/telpo_push_wanjiaan/log:/var/telpo_pushwanjiaan/logs --restart=always --name telpo_push_wanjiaan registry.cn-shanghai.aliyuncs.com/gps_card/telpo_push_wanjiaan:$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_wanjiaan || true
  19. docker rm telpo_push_wanjiaan || true
  20. docker rmi -f $(docker images | grep 139.224.254.18:5000/telpo_push_wanjiaan | awk '{print $3}')
  21. docker pull 139.224.254.18:5000/telpo_push_wanjiaan:$version
  22. docker run -d --network=host -e environment=${environment} -v /home/data/telpo_push_wanjiaan/log:/var/telpo_pushwanjiaan/logs --restart=always --name telpo_push_wanjiaan 139.224.254.18:5000/telpo_push_wanjiaan:$version;
  23. #删除产生的None镜像
  24. docker rmi -f $(docker images | grep none | awk '{print $3}')
  25. docker ps -a
  26. fi