generate-dockerfile-links-partial.tmpl 972 B

123456789101112131415161718192021222324252627282930313233
  1. {{- /*
  2. This template defines the "Supported tags and Dockerfile links" portion of an image description.
  3. */ -}}
  4. {{- define "dockerfilePath" -}}
  5. {{- if ne .Directory "." -}}
  6. {{- .Directory -}}
  7. /
  8. {{- end -}}
  9. Dockerfile
  10. {{- end -}}
  11. {{- range $i, $e := $.Entries -}}
  12. {{- /* force bashbrew to "fetch" the GitCommit so that it is fully resolved */ -}}
  13. {{- $from := $.DockerFrom $e -}}
  14. {{- $repoUrlBase := $e.GitRepo | replace "git://" "https://" | trimSuffixes ".git" -}}
  15. {{- $isGitHub := hasPrefix "https://github.com/" $repoUrlBase -}}
  16. {{- if $i -}}
  17. {{- "\n" -}}
  18. {{- end -}}
  19. - {{- "\t" -}}
  20. {{- if $isGitHub -}} [ {{- end -}}
  21. ` {{- $e.Tags | join "`, `" -}} ` (* {{- template "dockerfilePath" $e -}} *)
  22. {{- if $isGitHub -}} ]( {{- $repoUrlBase -}} /blob/ {{- $e.GitCommit -}} / {{- template "dockerfilePath" $e -}} ) {{- end -}}
  23. {{- /* TODO decide what to do (if anything) about non-GitHub repos with respect to URL */ -}}
  24. {{- end -}}
  25. {{- "\n\n" -}}