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.

40 line
2.1KB

  1. #!/bin/bash
  2. environment=$1
  3. version=$2
  4. echo "环境变量为$environment,版本为$version!"
  5. if [[ $environment == 'pro' ]]; then
  6. echo "开始远程构建容器"
  7. docker stop iot_gateway_service || true
  8. docker rm iot_gateway_service || true
  9. docker rmi -f $(docker images | grep registry.cn-shanghai.aliyuncs.com/telpo_platform/iot_gateway_service | 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/telpo_platform/iot_gateway_service:$version
  12. docker run -v /home/data/iotgatewayserver/log:/var/log/iotgatewayserver -e active=pro --restart=always -d --network host --name iot_gateway_service registry.cn-shanghai.aliyuncs.com/telpo_platform/iot_gateway_service:$version
  13. #删除产生的None镜像
  14. docker rmi -f $(docker images | grep none | awk '{print $3}')
  15. docker ps -a
  16. else
  17. if [[ $environment == 'test' ]]; then
  18. #echo "开始远程构建容器"
  19. docker stop iot_gateway_service || true
  20. docker rm iot_gateway_service || true
  21. docker rmi -f $(docker images | grep 139.224.254.18:5000/iot_gateway_service | awk '{print $3}')
  22. docker pull 139.224.254.18:5000/iot_gateway_service:$version
  23. docker run -v /home/data/iotgatewayserver/log:/var/log/iotgatewayserver -e active=test --restart=always -d --network host --name iot_gateway_service 139.224.254.18:5000/iot_gateway_service:$version
  24. #删除产生的None镜像
  25. docker rmi -f $(docker images | grep none | awk '{print $3}')
  26. docker ps -a
  27. else
  28. docker stop iot_gateway_service || true
  29. docker rm iot_gateway_service || true
  30. docker rmi -f $(docker images | grep 139.224.254.18:5000/iot_gateway_service | awk '{print $3}')
  31. docker pull 139.224.254.18:5000/iot_gateway_service:$version
  32. docker run -v /home/data/iotgatewayserver/log:/var/log/iotgatewayserver -e active=dev --restart=always -d --network host --name iot_gateway_service telpo/iot_gateway_service:$version
  33. #删除产生的None镜像
  34. docker rmi -f $(docker images | grep none | awk '{print $3}')
  35. docker ps -a
  36. fi
  37. fi