Skip to content

Commit f5ccd85

Browse files
committed
Add proper Architectures entries in "generate-stackbrew-library.sh"
1 parent 0a5405c commit f5ccd85

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

generate-stackbrew-library.sh

+24
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,22 @@ dirCommit() {
3232
)
3333
}
3434

35+
getArches() {
36+
local repo="$1"; shift
37+
local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/'
38+
39+
eval "declare -g -A parentRepoToArches=( $(
40+
find -name 'Dockerfile' -exec awk '
41+
toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|microsoft\/[^:]+)(:|$)/ {
42+
print "'"$officialImagesUrl"'" $2
43+
}
44+
' '{}' + \
45+
| sort -u \
46+
| xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
47+
) )"
48+
}
49+
getArches 'wordpress'
50+
3551
cat <<-EOH
3652
# this file is generated via https://github.com/docker-library/wordpress/blob/$(fileCommit "$self")/$self
3753
@@ -96,9 +112,13 @@ for phpVersion in "${phpVersions[@]}"; do
96112
fullAliases+=( "${phpVersionAliases[@]}" )
97113
fi
98114

115+
variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$dir/Dockerfile")"
116+
variantArches="${parentRepoToArches[$variantParent]}"
117+
99118
echo
100119
cat <<-EOE
101120
Tags: $(join ', ' "${fullAliases[@]}")
121+
Architectures: $(join ', ' $variantArches)
102122
GitCommit: $commit
103123
Directory: $dir
104124
EOE
@@ -148,9 +168,13 @@ for phpVersion in "${phpVersions[@]}"; do
148168
"${phpVersionVariantAliases[@]}"
149169
)
150170

171+
variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$dir/Dockerfile")"
172+
variantArches="${parentRepoToArches[$variantParent]}"
173+
151174
echo
152175
cat <<-EOE
153176
Tags: $(join ', ' "${fullAliases[@]}")
177+
Architectures: $(join ', ' $variantArches)
154178
GitCommit: $commit
155179
Directory: $dir
156180
EOE

0 commit comments

Comments
 (0)