build-node-docker.sh 719 B

1234567891011121314151617181920212223242526
  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. # Look for image locally
  8. if ! docker inspect ${IMAGE} > /dev/null;
  9. then
  10. # Not found, try to fetch from remote repo
  11. echo "Trying to fetch cached ${IMAGE} image"
  12. docker pull ${IMAGE} || :
  13. # If we didn't find it, build it
  14. if ! docker inspect ${IMAGE} > /dev/null;
  15. then
  16. echo "Building ${IMAGE}.."
  17. docker build . --file joystream-node.Dockerfile --tag ${IMAGE} --build-arg TEST_NODE=${TEST_NODE}
  18. fi
  19. else
  20. echo "Found ${IMAGE} in local repo"
  21. fi