pre_build 656 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env bash
  2. set -ex
  3. # If requested, print some environment info for troubleshooting.
  4. if [[ -n "${DOCKER_HUB_DEBUG}" ]]; then
  5. id
  6. pwd
  7. df -h
  8. env
  9. docker info
  10. docker version
  11. fi
  12. # Install build dependencies.
  13. deps=(
  14. jq
  15. )
  16. apt-get update
  17. apt-get install -y "${deps[@]}"
  18. # Docker Hub uses a shallow clone and doesn't fetch tags, which breaks some
  19. # Git operations that we perform later, so fetch the complete history and
  20. # tags first. Note that if the build is cached, the clone may have been
  21. # unshallowed already; if so, unshallowing will fail, so skip it.
  22. if [[ -f .git/shallow ]]; then
  23. git fetch --unshallow --tags
  24. fi