dpush-kunxiang.sh 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/bin/bash
  2. BUILD_TAG="prod-jxsh"
  3. REGISTRY_URL="registry-internal.cn-hangzhou.aliyuncs.com"
  4. NAME_SPACE="c-wms"
  5. if [ "$2" != "" ];
  6. then
  7. BUILD_TAG="$2"
  8. fi
  9. # build_push_tag
  10. push_tag()
  11. {
  12. set -e
  13. # push cluster
  14. cd $WORKSPACE/web-cluster
  15. docker build -t cluster:$BUILD_TAG .
  16. docker tag cluster:$BUILD_TAG $REGISTRY_URL/$NAME_SPACE/cluster:$BUILD_TAG
  17. docker push $REGISTRY_URL/$NAME_SPACE/cluster:$BUILD_TAG
  18. docker rmi cluster:$BUILD_TAG
  19. docker rmi $REGISTRY_URL/$NAME_SPACE/cluster:$BUILD_TAG
  20. # push idg
  21. cd $WORKSPACE/web-idg
  22. docker build -t idg:$BUILD_TAG .
  23. docker tag idg:$BUILD_TAG $REGISTRY_URL/$NAME_SPACE/web-idg:$BUILD_TAG
  24. docker push $REGISTRY_URL/$NAME_SPACE/web-idg:$BUILD_TAG
  25. docker rmi idg:$BUILD_TAG
  26. docker rmi $REGISTRY_URL/$NAME_SPACE/web-idg:$BUILD_TAG
  27. # push clis
  28. cd $WORKSPACE/web-clis
  29. docker build -t clis:$BUILD_TAG .
  30. docker tag clis:$BUILD_TAG $REGISTRY_URL/$NAME_SPACE/clis:$BUILD_TAG
  31. docker push $REGISTRY_URL/$NAME_SPACE/clis:$BUILD_TAG
  32. docker rmi clis:$BUILD_TAG
  33. docker rmi $REGISTRY_URL/$NAME_SPACE/clis:$BUILD_TAG
  34. # push clws
  35. cd $WORKSPACE/web-clws
  36. docker build -t clws:$BUILD_TAG .
  37. docker tag clws:$BUILD_TAG $REGISTRY_URL/$NAME_SPACE/clws:$BUILD_TAG
  38. docker push $REGISTRY_URL/$NAME_SPACE/clws:$BUILD_TAG
  39. docker rmi clws:$BUILD_TAG
  40. docker rmi $REGISTRY_URL/$NAME_SPACE/clws:$BUILD_TAG
  41. # push edi
  42. cd $WORKSPACE/web-edi
  43. docker build -t edi:$BUILD_TAG .
  44. docker tag edi:$BUILD_TAG $REGISTRY_URL/$NAME_SPACE/edi:$BUILD_TAG
  45. docker push $REGISTRY_URL/$NAME_SPACE/edi:$BUILD_TAG
  46. docker rmi edi:$BUILD_TAG
  47. docker rmi $REGISTRY_URL/$NAME_SPACE/edi:$BUILD_TAG
  48. cd $WORKSPACE/web-task
  49. docker build -t task:$BUILD_TAG .
  50. docker tag task:$BUILD_TAG $REGISTRY_URL/$NAME_SPACE/task:$BUILD_TAG
  51. docker push $REGISTRY_URL/$NAME_SPACE/task:$BUILD_TAG
  52. docker rmi task:$BUILD_TAG
  53. docker rmi $REGISTRY_URL/$NAME_SPACE/task:$BUILD_TAG
  54. cd $WORKSPACE/web-boot
  55. docker build -t boot:$BUILD_TAG .
  56. docker tag boot:$BUILD_TAG $REGISTRY_URL/$NAME_SPACE/boot:$BUILD_TAG
  57. docker push $REGISTRY_URL/$NAME_SPACE/boot:$BUILD_TAG
  58. docker rmi boot:$BUILD_TAG
  59. docker rmi $REGISTRY_URL/$NAME_SPACE/boot:$BUILD_TAG
  60. cd $WORKSPACE/web-els
  61. docker build -t web-els:$BUILD_TAG .
  62. docker tag web-els:$BUILD_TAG $REGISTRY_URL/$NAME_SPACE/web-els:$BUILD_TAG
  63. docker push $REGISTRY_URL/$NAME_SPACE/web-els:$BUILD_TAG
  64. docker rmi web-els:$BUILD_TAG
  65. docker rmi $REGISTRY_URL/$NAME_SPACE/web-els:$BUILD_TAG
  66. }
  67. if [ "$1" = "test" ];
  68. then
  69. # login
  70. REGISTRY_URL="172.172.172.201:5000"
  71. NAME_SPACE="c-wms"
  72. docker login --username=cwms $REGISTRY_URL --password=Cwms1234
  73. push_tag
  74. elif [ "$1" = "prod" ];
  75. then
  76. REGISTRY_URL="registry-internal.cn-hangzhou.aliyuncs.com"
  77. NAME_SPACE="c-wms"
  78. docker login --username=hr13915970954 $REGISTRY_URL --password=Cwms1234
  79. push_tag
  80. elif [ "$1" = "common" ];
  81. then
  82. REGISTRY_URL="registry-vpc.cn-hangzhou.aliyuncs.com"
  83. NAME_SPACE="hrsoftcust"
  84. push_tag
  85. else
  86. echo '测试环境参考命令:dpush.sh test test1001'
  87. echo '生产环境参考命令:dpush.sh prod prod-jxsh'
  88. fi