http-images.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. set -e
  3. tag=$1
  4. if [ -n "$tag" ]
  5. then
  6. echo "当前镜像tag: $tag"
  7. else
  8. echo "请输入当前镜像tag"
  9. exit
  10. fi
  11. ### go testing
  12. # echo "============ go test start ================"
  13. # make ci-test
  14. # echo "============ go test end ================"
  15. ### go build
  16. echo "============ go build start ================"
  17. make build version=${tag}
  18. echo "============ go build end ================"
  19. echo "============push images start================"
  20. export aliYunDockerDNS=registry.cn-hangzhou.aliyuncs.com
  21. export aliYunDockerUsername=kptzhu@163.com
  22. export aliYunDockerPassword=zhuz1898
  23. export images=kpt-event/kpt-tmr
  24. docker build -t ${images}:${tag} -f ./Dockerfile .
  25. docker login ${aliYunDockerDNS} --username ${aliYunDockerUsername} --password ${aliYunDockerPassword}
  26. docker tag ${images}:${tag} ${aliYunDockerDNS}/${images}:${tag}
  27. docker tag ${images}:${tag} ${aliYunDockerDNS}/${images}:latest
  28. docker push ${aliYunDockerDNS}/${images}:${tag}
  29. docker push ${aliYunDockerDNS}/${images}:latest
  30. docker rmi ${images}:${tag} ${aliYunDockerDNS}/${images}:${tag} ${aliYunDockerDNS}/${images}:latest
  31. echo "============push images end ================"