build-node-docker.sh 873 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env bash
  2. set -e
  3. # Looks for a cached joystream/node image matching code shasum.
  4. # Search order: local repo then dockerhub. If no cached image is found we build it.
  5. CODE_HASH=`scripts/runtime-code-shasum.sh`
  6. IMAGE=joystream/node:${CODE_HASH}
  7. # TODO: Check for valid JSON in ALL_PROPOSALS_PARAMETERS_JSON ?
  8. # Look for image locally
  9. if ! docker inspect ${IMAGE} > /dev/null;
  10. then
  11. # Not found, try to fetch from remote repo
  12. echo "Trying to fetch cached ${IMAGE} image"
  13. docker pull ${IMAGE} || :
  14. # If we didn't find it, build it
  15. if ! docker inspect ${IMAGE} > /dev/null;
  16. then
  17. echo "Building ${IMAGE}.."
  18. docker build . --file joystream-node.Dockerfile --tag ${IMAGE} \
  19. --build-arg TEST_NODE=${TEST_NODE} \
  20. --build-arg ALL_PROPOSALS_PARAMETERS_JSON=${ALL_PROPOSALS_PARAMETERS_JSON}
  21. fi
  22. else
  23. echo "Found ${IMAGE} in local repo"
  24. fi