Advertisement
Guest User

Untitled

a guest
Jan 26th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. set -e
  4.  
  5. #setup vars
  6. repo=$1
  7. tag=$2
  8.  
  9. usage () {
  10. echo "Need to specify repo as first arg, tag as second"
  11. exit 1
  12. }
  13.  
  14. if [ -z "${repo}" ] ; then
  15. usage
  16. fi
  17.  
  18. if [ -z "${tag}" ] ; then
  19. usage
  20. fi
  21.  
  22. #cleanup
  23. rm -f push
  24.  
  25. #pull base
  26. if [ ! -z "${base}" ] ; then
  27. docker pull "${base}"
  28. fi
  29.  
  30. docker build -t "${repo}:${tag}" .
  31. docker tag "${repo}:${tag}" "${repo}:latest"
  32.  
  33. echo "#!/bin/bash
  34.  
  35. set -e
  36.  
  37. docker push ${repo}:${tag}
  38. docker push ${repo}:latest
  39. rm push
  40. " > push
  41.  
  42. chmod +x push
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement