build-node-docker.sh 875 B

1234567891011121314151617181920212223242526272829303132
  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. # Finally image is tagged as "latest"
  6. CODE_HASH=`scripts/runtime-code-shasum.sh`
  7. IMAGE=joystream/node:${CODE_HASH}
  8. LATEST=joystream/node:latest
  9. # Look for image locally
  10. if ! docker inspect ${IMAGE} > /dev/null;
  11. then
  12. # Not found, try to fetch from remote repo
  13. echo "Trying to fetch cached ${IMAGE} image"
  14. docker pull ${IMAGE} || :
  15. # If we didn't find it, build it
  16. if ! docker inspect ${IMAGE} > /dev/null;
  17. then
  18. echo "Building ${IMAGE}.."
  19. docker build . --file joystream-node.Dockerfile --tag ${IMAGE}
  20. fi
  21. else
  22. echo "Found ${IMAGE} in local repo"
  23. fi
  24. # At this point image should be in local repo
  25. # echo "Tagging ${IMAGE} as ${LATEST}"
  26. # docker image tag ${IMAGE} ${LATEST}