build.sh 951 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. #
  3. # This script is executed from within the container.
  4. #
  5. set -e
  6. EXTRA_OPTS="$@"
  7. CCX64=/tmp/x86_64-centos6-linux-gnu/bin/x86_64-centos6-linux-gnu-gcc
  8. GOPATH=/go
  9. REPO_PATH=$GOPATH/src/github.com/grafana/grafana
  10. cd /go/src/github.com/grafana/grafana
  11. echo "current dir: $(pwd)"
  12. if [ "$CIRCLE_TAG" != "" ]; then
  13. echo "Building releases from tag $CIRCLE_TAG"
  14. OPT="-includeBuildNumber=false ${EXTRA_OPTS}"
  15. else
  16. echo "Building incremental build for $CIRCLE_BRANCH"
  17. OPT="-buildNumber=${CIRCLE_BUILD_NUM} ${EXTRA_OPTS}"
  18. fi
  19. echo "Build arguments: $OPT"
  20. CC=${CCX64} go run build.go ${OPT} build
  21. yarn install --pure-lockfile --no-progress
  22. echo "current dir: $(pwd)"
  23. if [ -d "dist" ]; then
  24. rm -rf dist
  25. fi
  26. echo "Building frontend"
  27. go run build.go ${OPT} build-frontend
  28. # Load ruby, needed for packing with fpm
  29. source /etc/profile.d/rvm.sh
  30. echo "Packaging"
  31. go run build.go -goos linux -pkg-arch amd64 ${OPT} package-only latest