北斗定位
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

66 lines
2.1KB

  1. #!/bin/bash
  2. mvn clean
  3. mvn package -Dmaven.test.skip=true
  4. #image_version=$(date +%Y%m%d%H%M)
  5. image_version=$version
  6. #docker cp docker_jenkins:/var/jenkins_home/workspace/dipperpos_service/target/dipperposition.jar
  7. # /usr/local/dipperposition/dipperposition.jar
  8. docker stop dipperposition_service || true
  9. docker rm dipperposition_service || true
  10. # 删除镜像
  11. docker rmi -f $(docker images | grep telpo/dipperposition_service | awk '{print $3}')
  12. docker build . -t telpo/dipperposition_service:$image_version
  13. #TODO:推送镜像到私有仓库
  14. echo '=================开始推送镜像======================='
  15. docker tag telpo/dipperposition_service:$image_version 139.224.254.18:5000/dipperposition_service:$image_version
  16. docker push 139.224.254.18:5000/dipperposition_service:$image_version
  17. echo '=================推送镜像完成======================='
  18. #删除产生的None镜像
  19. docker rmi -f $(docker images | grep none | awk '{print $3}')
  20. # 查看镜像列表
  21. docker images
  22. # 启动容器
  23. docker run -v /home/data/dipperposition/log:/var/log/dipperposition -d -e active=dev --network host --restart=always -p 9011:9011 -p 9012:9012 -p 9013:9013 --name dipperposition_service 139.224.254.18:5000/dipperposition_service:$image_version
  24. #echo "scp ${WORKSPACE} files......begin"
  25. #set passwd "telpo#1234"
  26. #scp /var/jenkins_home/workspace/dipperpos_service/target/dipperposition.jar root@47.116.142.20:/home/data/dipperposition/dipperposition.jar
  27. #expect {
  28. # "密码:"
  29. # {
  30. # send "$passwd\n"
  31. # }
  32. # "pass"
  33. # {
  34. # send "$passwd\n"
  35. # }
  36. #
  37. # "yes/no"
  38. # {
  39. # sleep 5
  40. # send_user "send yes"
  41. # send "yes\n"
  42. # }
  43. # eof
  44. # {
  45. # sleep 5
  46. # send_user "eof\n"
  47. # }
  48. #}
  49. #send "exit\r"
  50. #expect eof
  51. #echo "scp ${WORKSPACE} files......end"
  52. # 查看日志
  53. #docker logs dipperposition_service
  54. #echo '=================启动NettyAPP======================='
  55. #ps -ef |grep dipperposition |awk '{print $2}'|xargs kill -9
  56. #java -jar -Xms256m -Xmx256m -Xss256k -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m
  57. # /usr/local/dipperposition/dipperposition.jar --spring.profiles.active=dev
  58. #echo '=================完成NettyAPP启动======================='