build-docker.sh 667 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. set -e
  3. if [ $# -ne 1 ]; then
  4. echo "Usage: $0 tag" >/dev/stderr
  5. exit 1
  6. fi
  7. tag=$1
  8. tgt=$(mktemp -d)
  9. # Build flannel inside
  10. docker run -v `pwd`/../:/opt/flannel -i -t golang:1.4.2 /bin/bash -c "cd /opt/flannel && ./build"
  11. # Generate Dockerfile into target tmp dir
  12. cat <<DF >${tgt}/Dockerfile
  13. FROM quay.io/coreos/flannelbox:1.0
  14. MAINTAINER Eugene Yakubovich <eugene.yakubovich@coreos.com>
  15. ADD ./flanneld /opt/bin/
  16. ADD ./mk-docker-opts.sh /opt/bin/
  17. CMD /opt/bin/flanneld
  18. DF
  19. # Copy artifcats into target dir and build the image
  20. cp ../bin/flanneld $tgt
  21. cp ./mk-docker-opts.sh $tgt
  22. docker build -t quay.io/coreos/flannel:${tag} $tgt
  23. # Cleanup
  24. rm -rf $tgt