健康同学微信公众号h5项目
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.

37 lines
1.7KB

  1. #!/bin/bash
  2. ###
  3. # @Date: 2022-08-18 09:19:07
  4. # @LastEditors: JinxChen
  5. # @LastEditTime: 2022-08-18 10:06:40
  6. # @FilePath: \TelpoH5FrontendWeb\h5_frontend_web_run.sh
  7. # @description: 部署脚本
  8. ###
  9. environment=$1
  10. version=$2
  11. echo "环境变量为${environment},版本为$version!"
  12. if [[ ${environment} = 'production' ]];
  13. then
  14. echo "开始远程构建容器"
  15. docker stop h5_frontend_web || true;
  16. docker rm h5_frontend_web || true;
  17. docker rmi -f $(docker images | grep registry.cn-shanghai.aliyuncs.com/tolpo_platform/h5_frontend_web | awk '{print $3}')
  18. #docker login --username=telpo_linwl@1111649216405698 --password=telpo#1234 registry.cn-shanghai.aliyuncs.com;
  19. #docker login --username=telpo_fengjj@1111649216405698 --password=PWDaliyun123 registry.cn-shanghai.aliyuncs.com
  20. docker login --username=rzl_wangjx@1111649216405698 --password=telpo.123 registry.cn-shanghai.aliyuncs.com
  21. docker pull registry.cn-shanghai.aliyuncs.com/tolpo_platform/h5_frontend_web:$version
  22. docker run -p 8075:80 -d --restart=always --name h5_frontend_web registry.cn-shanghai.aliyuncs.com/tolpo_platform/h5_frontend_web:$version;
  23. #删除产生的None镜像
  24. docker rmi -f $(docker images | grep none | awk '{print $3}')
  25. docker ps -a
  26. else
  27. echo "开始在测试环境远程构建容器"
  28. docker stop h5_frontend_web || true
  29. docker rm h5_frontend_web || true
  30. docker rmi -f $(docker images | grep 139.224.254.18:5000/h5_frontend_web | awk '{print $3}')
  31. docker pull 139.224.254.18:5000/h5_frontend_web:$version
  32. docker run -p 8075:80 -d --restart=always --name h5_frontend_web 139.224.254.18:5000/h5_frontend_web:$version;
  33. #删除产生的None镜像
  34. docker rmi -f $(docker images | grep none | awk '{print $3}')
  35. docker ps -a
  36. fi