build_jar.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/bash
  2. ###############################################################################
  3. # 构建 bnt 应用
  4. ###############################################################################
  5. set -e
  6. proj_dir='~/Downloads/bnt'
  7. ###############################################################################
  8. # 构建依赖
  9. ###############################################################################
  10. build_dependencies() {
  11. cd ${proj_dir}
  12. git clone https://git.reghao.cn/reghao/jutil
  13. cd jutil
  14. mvn clean install -Dmaven.test.skip=true
  15. cd ${proj_dir}
  16. git clone https://git.reghao.cn/reghao/oss
  17. cd oss
  18. mvn clean install -Dmaven.test.skip=true -pl oss/oss-sdk
  19. }
  20. ###############################################################################
  21. # 构建 bnt 应用 jar 包
  22. ###############################################################################
  23. build_jar() {
  24. cd ${proj_dir}
  25. mvn clean package -Dmaven.test.skip
  26. }
  27. ###############################################################################
  28. # 运行 bnt 应用
  29. ###############################################################################
  30. exec_jar() {
  31. cd ${proj_dir}/web/bin
  32. bash start.sh
  33. }
  34. ###############################################################################
  35. # 构建 bnt 应用镜像
  36. ###############################################################################
  37. build_image() {
  38. commit_id=`git rev-parse HEAD | cut -c 1-8`
  39. docker_prefix='bnt'
  40. cd ${proj_dir}/bnt/web/
  41. docker build -t ${docker_prefix}/gateway:${commit_id} .
  42. }
  43. exec_image() {
  44. echo "not implement..."
  45. }
  46. echo "构建第三方依赖..."
  47. build_dependencies
  48. echo "构建 bnt jar 应用..."
  49. build_jar
  50. echo "运行 bnt jar 应用..."
  51. exec_jar