generate-dockerfile-links-partial.tmpl 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. {{- /*
  2. This template defines the "Supported tags and Dockerfile links" portion of an image description.
  3. */ -}}
  4. {{- $archSpecific := getenv "ARCH_SPECIFIC_DOCS" -}}
  5. {{- $sharedTagGroups := .Manifest.GetSharedTagGroups -}}
  6. {{- if (len $sharedTagGroups) -}}
  7. (See ["What's the difference between 'Shared' and 'Simple' tags?" in the FAQ](https://github.com/docker-library/faq#whats-the-difference-between-shared-and-simple-tags).)
  8. {{- "\n\n" -}}
  9. ## Simple Tags
  10. {{- "\n\n" -}}
  11. {{- end -}}
  12. {{- range $i, $e := ($archSpecific | ternary (archFilter arch $.Entries) $.Entries) -}}
  13. {{- $arch := $archSpecific | ternary arch ($e.HasArchitecture arch | ternary arch ($e.Architectures | first)) -}}
  14. {{- /* force bashbrew to "fetch" the GitCommit so that it is fully resolved */ -}}
  15. {{- $froms := $.ArchDockerFroms $arch $e -}}
  16. {{- $gitRepo := $e.ArchGitRepo $arch -}}
  17. {{- $repoUrlBase := $gitRepo | replace "git://" "https://" | trimSuffixes ".git" -}}
  18. {{- $isGitHub := hasPrefix "https://github.com/" $repoUrlBase -}}
  19. {{- if $i -}}
  20. {{- "\n" -}}
  21. {{- end -}}
  22. - {{- "\t" -}}
  23. {{- if $isGitHub -}} [ {{- end -}}
  24. {{- $dir := .ArchDirectory $arch -}}
  25. {{- $dockerfile := .ArchFile $arch -}}
  26. {{- $dockerfilePath := eq $dir "." | ternary $dockerfile (join "/" $dir $dockerfile) -}}
  27. ` {{- $e.Tags | join "`, `" -}} `
  28. {{- $gitCommit := $e.ArchGitCommit $arch -}}
  29. {{- if $isGitHub -}} ]( {{- $repoUrlBase -}} /blob/ {{- $gitCommit -}} / {{- $dockerfilePath -}} ) {{- end -}}
  30. {{- /* TODO decide what to do (if anything) about non-GitHub repos with respect to URL */ -}}
  31. {{- end -}}
  32. {{- "\n\n" -}}
  33. {{- if (len $sharedTagGroups) -}}
  34. {{- "## Shared Tags\n\n" -}}
  35. {{- range $sharedTagGroups -}}
  36. {{- $entries := $archSpecific | ternary (archFilter arch .Entries) .Entries -}}
  37. {{- if (len $entries) -}}
  38. {{- "-\t`" -}}
  39. {{ .SharedTags | join "`, `" }}
  40. {{- "`:\n" -}}
  41. {{- range $i, $e := $entries -}}
  42. {{- $arch := $archSpecific | ternary arch ($e.HasArchitecture arch | ternary arch ($e.Architectures | first)) -}}
  43. {{- /* force bashbrew to "fetch" the GitCommit so that it is fully resolved */ -}}
  44. {{- $froms := $.ArchDockerFroms $arch $e -}}
  45. {{- $gitRepo := $e.ArchGitRepo $arch -}}
  46. {{- $repoUrlBase := $gitRepo | replace "git://" "https://" | trimSuffixes ".git" -}}
  47. {{- $isGitHub := hasPrefix "https://github.com/" $repoUrlBase -}}
  48. {{- "\t-\t" -}}
  49. {{- if $isGitHub -}} [ {{- end -}}
  50. {{- $dir := .ArchDirectory $arch -}}
  51. {{- $dockerfile := .ArchFile $arch -}}
  52. {{- $dockerfilePath := eq $dir "." | ternary $dockerfile (join "/" $dir $dockerfile) -}}
  53. ` {{- $e.Tags | first -}} `
  54. {{- $gitCommit := $e.ArchGitCommit $arch -}}
  55. {{- if $isGitHub -}} ]( {{- $repoUrlBase -}} /blob/ {{- $gitCommit -}} / {{- $dockerfilePath -}} ) {{- end -}}
  56. {{- /* TODO decide what to do (if anything) about non-GitHub repos with respect to URL */ -}}
  57. {{- "\n" -}}
  58. {{- end -}}
  59. {{- end -}}
  60. {{- end -}}
  61. {{- "\n" -}}
  62. {{- end -}}