build-node-docker.sh 631 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. set -e
  3. if ! command -v docker-compose &> /dev/null
  4. then
  5. echo "docker-compose not found. Skipping docker image builds."
  6. exit 0
  7. fi
  8. # Fetch a cached joystream/node image if one is found matching code shasum instead of building
  9. CODE_HASH=`scripts/runtime-code-shasum.sh`
  10. IMAGE=joystream/node:${CODE_HASH}
  11. echo "Trying to fetch cached ${IMAGE} image"
  12. docker pull ${IMAGE} || :
  13. if ! docker inspect ${IMAGE} > /dev/null;
  14. then
  15. echo "Fetch failed, building image locally"
  16. docker-compose build joystream-node
  17. else
  18. echo "Tagging cached image as 'latest'"
  19. docker image tag ${IMAGE} joystream/node:latest
  20. fi