The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

51 lines
1.8 KiB

  1. #!/bin/bash
  2. #
  3. # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
  4. #
  5. # Build, run or push a docker container for a Bubble launcher. Intended for developer use.
  6. #
  7. # bubble.sh [mode] [version]
  8. #
  9. # mode : build, run or push
  10. # build - build the docker image
  11. # run - run the docker image
  12. # push - push to docker hub
  13. #
  14. # version : version to use, default is read from bubble-server/src/main/resources/META-INF/bubble/bubble.properties
  15. #
  16. # The docker tag used will be getbubble/launcher:version
  17. #
  18. function die {
  19. echo 1>&2 "${1}"
  20. exit 1
  21. }
  22. THISDIR="$(cd "$(dirname "${0}")" && pwd)"
  23. BUBBLE_DIR="$(cd "${THISDIR}/.." && pwd)"
  24. MODE=${1:?no mode specified, use build or run}
  25. META_FILE="${BUBBLE_DIR}/bubble-server/src/main/resources/META-INF/bubble/bubble.properties"
  26. VERSION="${2:-$(cat ${META_FILE} | grep bubble.version | awk -F '=' '{print $2}' | awk -F ' ' '{print $NF}' | awk '{$1=$1};1')}"
  27. if [[ -z "${VERSION}" ]] ; then
  28. die "Error determining version from: ${META_FILE}"
  29. fi
  30. BUBBLE_TAG="getbubble/launcher:${VERSION}"
  31. if [[ "${MODE}" == "build" ]] ; then
  32. if [[ $(find bubble-server/target -type f -name "bubble-server-*.jar" | wc -l | tr -d ' ') -eq 0 ]] ; then
  33. die "No bubble jar found in $(pwd)/bubble-server/target"
  34. fi
  35. docker build -t ${BUBBLE_TAG} . || die "Error building docker image"
  36. elif [[ "${MODE}" == "run" ]] ; then
  37. docker run --env-file <(cat "${HOME}/.bubble.env" | sed -e 's/export //' | tr -d '"' | tr -d "'") -p 8090:8090 -t ${BUBBLE_TAG} || die "Error running docker container"
  38. elif [[ "${MODE}" == "push" ]] ; then
  39. docker push ${BUBBLE_TAG} || die "Error pushing docker image"
  40. else
  41. die "Invalid mode (expected build or run): ${MODE}"
  42. fi