dianxin-guizhou-forward
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.

28 satır
1.0KB

  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 stop gd202101_service || true
  7. docker rm gd202101_service || true
  8. # 删除镜像
  9. docker rmi -f $(
  10. docker images | grep 139.224.254.18:5000/gd202101_service | awk '{print $3}'
  11. )
  12. docker build . -t telpo/gd202101_service:$image_version
  13. #TODO:推送镜像到私有仓库
  14. echo '=================开始推送镜像======================='
  15. docker tag telpo/gd202101_service:$image_version 139.224.254.18:5000/gd202101_service:$image_version
  16. docker push 139.224.254.18:5000/gd202101_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/gd202101server/log:/var/log/gd202101server -d -e active=test --network host --restart=always --name gd202101_service telpo/gd202101_service:$image_version
  24. # 查看日志
  25. # docker logs gd202101_service