build.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. set -ex
  3. WORK_DIR=$(dirname $(readlink -f $0))
  4. HUE_SRC=$(realpath $WORK_DIR/../..)
  5. BUILD_DIR=$(realpath $HUE_SRC/../containerbuild$GBN)
  6. HUE_DIR=$WORK_DIR/hue
  7. APACHE_DIR=$WORK_DIR/huelb
  8. REGISTRY=${REGISTRY:-"docker.io/hortonworks"}
  9. compile_hue() {
  10. mkdir -p $BUILD_DIR
  11. cd $HUE_SRC
  12. PREFIX=$BUILD_DIR make install
  13. cd $BUILD_DIR/hue
  14. APPS=$(find apps -maxdepth 2 -name "src" -type d|cut -d"/" -f2|sort| sed 's/[^ ]* */apps\/&/g')
  15. ./build/env/bin/python tools/app_reg/app_reg.py --install $APPS --relative-paths
  16. bash tools/relocatable.sh
  17. }
  18. find_git_state() {
  19. cd $HUE_SRC
  20. export GBRANCH=$(git ls-remote --get-url)"/commits/"$(git rev-parse --abbrev-ref HEAD)
  21. export GSHA=$(git ls-remote --get-url)"/commit/"$(git rev-list --no-walk HEAD)
  22. export VERSION=$(grep "VERSION=" VERSION | cut -d"=" -f2 | cut -d'"' -f2)
  23. }
  24. docker_hue_build() {
  25. cd $HUE_DIR
  26. cp -a $BUILD_DIR/hue $HUE_DIR
  27. rm -f $HUE_DIR/hue/desktop/conf/*
  28. docker build -f $HUE_DIR/Dockerfile -t ${REGISTRY}/hue:$GBN \
  29. --build-arg GBN=$GBN \
  30. --build-arg GSHA="$GSHA" \
  31. --build-arg GBRANCH=$GBRANCH \
  32. --build-arg VERSION=$VERSION \
  33. .
  34. }
  35. docker_huelb_build() {
  36. cd $APACHE_DIR
  37. cp -a $BUILD_DIR/hue/build/static $APACHE_DIR
  38. docker build -f $APACHE_DIR/Dockerfile -t ${REGISTRY}/huelb:$GBN \
  39. --build-arg GBN=$GBN \
  40. --build-arg GSHA="$GSHA" \
  41. --build-arg GBRANCH=$GBRANCH \
  42. --build-arg VERSION=$VERSION \
  43. .
  44. }
  45. compile_hue
  46. find_git_state
  47. docker_hue_build
  48. docker_huelb_build