build-docker-images.sh 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. # Build or fetch cached joystream/node docker image
  9. if [[ "$SKIP_JOYSTREAM_NODE" = 1 || "$SKIP_JOYSTREAM_NODE" = "true" ]]; then
  10. echo "Skipping build of joystream/node docker image."
  11. else
  12. # Fetch a cached joystream/node image if one is found matching code shasum instead of building
  13. CODE_HASH=`scripts/runtime-code-shasum.sh`
  14. IMAGE=joystream/node:${CODE_HASH}
  15. echo "Trying to fetch cached ${IMAGE} image"
  16. docker pull ${IMAGE} || :
  17. if ! docker inspect ${IMAGE} > /dev/null;
  18. then
  19. echo "Fetch failed, building image locally"
  20. docker-compose build joystream-node
  21. else
  22. echo "Tagging cached image as 'latest'"
  23. docker image tag ${IMAGE} joystream/node:latest
  24. fi
  25. fi
  26. # Build joystream/apps docker image
  27. echo "Building 'joystream/apps' docker image..."
  28. docker-compose build colossus
  29. # Build the pioneer docker image
  30. echo "Building pioneer docker image"
  31. docker-compose build pioneer