arches.sh 737 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. set -Eeuo pipefail
  3. repo="${1:-}"
  4. if [ -z "$repo" ]; then
  5. echo >&2 "usage: $0 repo"
  6. echo >&2 " ie: $0 hylang"
  7. exit 1
  8. fi
  9. # if we haven't set BASHBREW_LIBRARY explicitly (like Jenkins does, for example), don't trust the local library
  10. if [ -z "${BASHBREW_LIBRARY:-}" ]; then
  11. repo="https://github.com/docker-library/official-images/raw/master/library/$repo"
  12. fi
  13. bashbrew cat --format '
  14. {{- range .Entries -}}
  15. {{- range .Architectures -}}
  16. {{- $ns := archNamespace . -}}
  17. {{- if $ns -}}
  18. [
  19. {{- end -}}
  20. `{{- . -}}`
  21. {{- if $ns -}}
  22. ](https://hub.docker.com/r/{{- $ns -}}/{{- $.RepoName -}}/)
  23. {{- end -}}
  24. {{- ",\n" -}}
  25. {{- end -}}
  26. {{- end -}}
  27. ' "$repo" | sort -u | tr '\n' ' ' | sed 's/, $/\n/'