@@ -36,6 +36,22 @@ dirCommit() {
36
36
)
37
37
}
38
38
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
+
39
55
cat << -EOH
40
56
# this file is generated via https://github.com/docker-library/postgres/blob/$( fileCommit " $self " ) /$self
41
57
@@ -54,7 +70,9 @@ join() {
54
70
for version in " ${versions[@]} " ; do
55
71
commit=" $( dirCommit " $version " ) "
56
72
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// ' ~' / -} "
58
76
59
77
versionAliases=()
60
78
while [ " $fullVersion " != " $version " -a " ${fullVersion% [.-]* } " != " $fullVersion " ]; do
@@ -66,9 +84,19 @@ for version in "${versions[@]}"; do
66
84
${aliases[$version]:- }
67
85
)
68
86
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
+
69
96
echo
70
97
cat << -EOE
71
98
Tags: $( join ' , ' " ${versionAliases[@]} " )
99
+ Architectures: $( join ' , ' " ${versionArches[@]} " )
72
100
GitCommit: $commit
73
101
Directory: $version
74
102
EOE
@@ -81,9 +109,13 @@ for version in "${versions[@]}"; do
81
109
variantAliases=( " ${versionAliases[@]/%/ -$variant } " )
82
110
variantAliases=( " ${variantAliases[@]// latest-/ } " )
83
111
112
+ variantParent=" $( awk ' toupper($1) == "FROM" { print $2 }' " $version /$variant /Dockerfile" ) "
113
+ variantArches=" ${parentRepoToArches[$variantParent]} "
114
+
84
115
echo
85
116
cat << -EOE
86
117
Tags: $( join ' , ' " ${variantAliases[@]} " )
118
+ Architectures: $( join ' , ' $variantArches )
87
119
GitCommit: $commit
88
120
Directory: $version /$variant
89
121
EOE
0 commit comments