build.sh 951 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. current_path=`pwd`
  3. case "`uname`" in
  4. Darwin)
  5. bin_abs_path=`cd $(dirname $0); pwd`
  6. ;;
  7. Linux)
  8. bin_abs_path=$(readlink -f $(dirname $0))
  9. ;;
  10. *)
  11. bin_abs_path=`cd $(dirname $0); pwd`
  12. ;;
  13. esac
  14. BASE=${bin_abs_path}
  15. if [ ! -f $BASE/jdk*.rpm ] ; then
  16. DOWNLOAD_LINK="http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.tar.gz"
  17. wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie" "$DOWNLOAD_LINK" -O $BASE/jdk-8-linux-x64.rpm
  18. fi
  19. cd $BASE/../ && mvn clean package -Dmaven.test.skip -Denv=release && cd $current_path ;
  20. if [ "$1" == "kafka" ] ; then
  21. cp $BASE/../target/canal-kafka-*.tar.gz $BASE/
  22. docker build --no-cache -t canal/canal-server $BASE/
  23. else
  24. cp $BASE/../target/canal.deployer-*.tar.gz $BASE/
  25. docker build --no-cache -t canal/canal-server $BASE/
  26. fi