@@ -36,6 +36,22 @@ dirCommit() {
3636 )
3737}
3838
39+ getArches () {
40+ local repo=" $1 " ; shift
41+ local officialImagesUrl=' https://github.com/docker-library/official-images/raw/master/library/'
42+
43+ eval " declare -g -A parentRepoToArches=( $(
44+ find -name ' Dockerfile' -exec awk '
45+ toupper($1) == "FROM" && $2 !~ /^(' " $repo " ' |scratch|microsoft\/[^:]+)(:|$)/ {
46+ print "' " $officialImagesUrl " ' " $2
47+ }
48+ ' ' {}' + \
49+ | sort -u \
50+ | xargs bashbrew cat --format ' [{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
51+ ) )"
52+ }
53+ getArches ' postgres'
54+
3955cat << -EOH
4056# this file is generated via https://github.com/docker-library/postgres/blob/$( fileCommit " $self " ) /$self
4157
@@ -54,7 +70,9 @@ join() {
5470for version in " ${versions[@]} " ; do
5571 commit=" $( dirCommit " $version " ) "
5672
57- fullVersion=" $( git show " $commit " :" $version /Dockerfile" | awk ' $1 == "ENV" && $2 == "PG_VERSION" { gsub(/-.*$/, "", $3); gsub(/~/, "-", $3); print $3; exit }' ) "
73+ pgdgVersion=" $( git show " $commit " :" $version /Dockerfile" | awk ' $1 == "ENV" && $2 == "PG_VERSION" { print $3; exit }' ) "
74+ fullVersion=" ${pgdgVersion%% -* } "
75+ fullVersion=" ${fullVersion// ' ~' / -} "
5876
5977 versionAliases=()
6078 while [ " $fullVersion " != " $version " -a " ${fullVersion% [.-]* } " != " $fullVersion " ]; do
@@ -66,9 +84,19 @@ for version in "${versions[@]}"; do
6684 ${aliases[$version]:- }
6785 )
6886
87+ versionParent=" $( awk ' toupper($1) == "FROM" { print $2 }' " $version /Dockerfile" ) "
88+ versionArches=()
89+ # http://apt.postgresql.org/pub/repos/apt/dists/jessie-pgdg/main/
90+ for arch in amd64 i386 ppc64le; do
91+ if [[ " ${parentRepoToArches[$versionParent]} " =~ " $arch " ]]; then
92+ versionArches+=( " $arch " )
93+ fi
94+ done
95+
6996 echo
7097 cat << -EOE
7198 Tags: $( join ' , ' " ${versionAliases[@]} " )
99+ Architectures: $( join ' , ' " ${versionArches[@]} " )
72100 GitCommit: $commit
73101 Directory: $version
74102 EOE
@@ -81,9 +109,13 @@ for version in "${versions[@]}"; do
81109 variantAliases=( " ${versionAliases[@]/%/ -$variant } " )
82110 variantAliases=( " ${variantAliases[@]// latest-/ } " )
83111
112+ variantParent=" $( awk ' toupper($1) == "FROM" { print $2 }' " $version /$variant /Dockerfile" ) "
113+ variantArches=" ${parentRepoToArches[$variantParent]} "
114+
84115 echo
85116 cat << -EOE
86117 Tags: $( join ' , ' " ${variantAliases[@]} " )
118+ Architectures: $( join ' , ' $variantArches )
87119 GitCommit: $commit
88120 Directory: $version /$variant
89121 EOE
0 commit comments