cibot 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/usr/bin/env bash
  2. #
  3. # 发布镜像脚本
  4. #
  5. version='release-v1.0.0'
  6. # cwd
  7. cwd=$(pwd)
  8. #
  9. # Set Colors
  10. #
  11. bold=$(tput bold)
  12. underline=$(tput sgr 0 1)
  13. reset=$(tput sgr0)
  14. red=$(tput setaf 1)
  15. green=$(tput setaf 76)
  16. white=$(tput setaf 7)
  17. tan=$(tput setaf 202)
  18. blue=$(tput setaf 25)
  19. #
  20. # Headers and Logging
  21. #
  22. info() {
  23. printf "${white}➜ %s${reset}\n" "$@"
  24. }
  25. success() {
  26. printf "${green}✔ %s${reset}\n" "$@"
  27. }
  28. error() {
  29. printf "${red}✖ %s${reset}\n" "$@"
  30. }
  31. warn() {
  32. printf "${tan}➜ %s${reset}\n" "$@"
  33. }
  34. goBack(){
  35. cd ${cwd}
  36. }
  37. buildUi(){
  38. goBack
  39. cd fe
  40. walleUi="walle-ui:${version}"
  41. info "开始构建:${walleUi}"
  42. docker build --tag walle/${walleUi} .
  43. success "开始上传:${walleUi}"
  44. docker push walle/${walleUi}
  45. success "上传成功:${walleUi}"
  46. }
  47. buildApiServer(){
  48. goBack
  49. walleApi="walle-api:${version}"
  50. info "开始构建:${walleApi}"
  51. docker build --tag walle/${walleApi} .
  52. success "开始上传:${walleApi}"
  53. docker push walle/${walleApi}
  54. success "上传成功:${walleApi}"
  55. }
  56. buildGateway(){
  57. goBack
  58. cd gateway
  59. walleGateway="walle-gateway:${version}"
  60. info "开始构建:${walleGateway}"
  61. docker build --tag "walle/${walleGateway}" .
  62. success "开始上传:${walleGateway}"
  63. docker push walle/${walleGateway}
  64. success "上传成功:${walleGateway}"
  65. }
  66. buildImage(){
  67. buildUi
  68. buildApiServer
  69. buildGateway
  70. }
  71. bootstrap(){
  72. info "开始构建"
  73. h1 "请输入仓库密码:"
  74. docker login --username=walle@qq.com
  75. buildImage
  76. success '构建成功'
  77. }
  78. bootstrap