build.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/usr/bin/env bash
  2. set -e
  3. yarn
  4. yarn workspace @joystream/types build
  5. yarn workspace @joystream/cd-schemas generate:all
  6. yarn workspace @joystream/cd-schemas build
  7. yarn workspace @joystream/cli build
  8. yarn workspace query-node-root build
  9. yarn workspace storage-node build
  10. # Not strictly needed during development, we run "yarn workspace pioneer start" to start
  11. # a dev instance, but will show highlight build issues
  12. yarn workspace pioneer build
  13. if ! command -v docker-compose &> /dev/null
  14. # Build or fetch cached joystream/node docker image
  15. if [[ "$SKIP_JOYSTREAM_NODE" = 1 || "$SKIP_JOYSTREAM_NODE" = "true" ]]; then
  16. echo "Skipping build of joystream/node docker image."
  17. else
  18. # Fetch a cached joystream/node image if one is found matching code shasum instead of building
  19. CODE_HASH=`scripts/runtime-code-shasum.sh`
  20. IMAGE=joystream/node:${CODE_HASH}
  21. echo "Trying to fetch cashed ${IMAGE} image"
  22. docker pull ${IMAGE} || :
  23. if ! docker inspect ${IMAGE} > /dev/null;
  24. then
  25. echo "Fetch failed, building image locally"
  26. docker-compose build joystream-node
  27. else
  28. echo "Tagging cached image as 'latest'"
  29. docker image tag ${IMAGE} joystream/node:latest
  30. fi
  31. fi
  32. # Build joystream/apps docker image
  33. echo "Building 'joystream/apps' docker image..."
  34. docker-compose build colossus
  35. then
  36. echo "docker-compose not found. Skipping docker image builds."
  37. fi
  38. # Build cargo crates: native binaries joystream/node, wasm runtime, and chainspec builder.
  39. if [[ "$SKIP_JOYSTREAM_NODE" = 1 || "$SKIP_JOYSTREAM_NODE" = "true" ]]; then
  40. echo "Skipping cargo build"
  41. else
  42. yarn cargo-checks
  43. yarn cargo-build
  44. fi