Skip to content

Commit 0797005

Browse files
authored
Merge pull request #167 from infosiftr/multiarch
Add proper Architectures entries in "generate-stackbrew-library.sh"
2 parents 2a73673 + 9106c7d commit 0797005

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

generate-stackbrew-library.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,22 @@ dirCommit() {
3737
)
3838
}
3939

40+
getArches() {
41+
local repo="$1"; shift
42+
local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/'
43+
44+
eval "declare -g -A parentRepoToArches=( $(
45+
find -name 'Dockerfile' -exec awk '
46+
toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|microsoft\/[^:]+)(:|$)/ {
47+
print "'"$officialImagesUrl"'" $2
48+
}
49+
' '{}' + \
50+
| sort -u \
51+
| xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
52+
) )"
53+
}
54+
getArches 'rabbitmq'
55+
4056
cat <<-EOH
4157
# this file is generated via https://github.com/docker-library/rabbitmq/blob/$(fileCommit "$self")/$self
4258
@@ -75,9 +91,13 @@ for version in "${versions[@]}"; do
7591
variantAliases=( "${variantAliases[@]//latest-/}" )
7692
fi
7793

94+
variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/$variant/Dockerfile")"
95+
variantArches="${parentRepoToArches[$variantParent]}"
96+
7897
echo
7998
cat <<-EOE
8099
Tags: $(join ', ' "${variantAliases[@]}")
100+
Architectures: $(join ', ' $variantArches)
81101
GitCommit: $commit
82102
Directory: $version/$variant
83103
EOE
@@ -95,6 +115,7 @@ for version in "${versions[@]}"; do
95115
echo
96116
cat <<-EOE
97117
Tags: $(join ', ' "${subVariantAliases[@]}")
118+
Architectures: $(join ', ' $variantArches)
98119
GitCommit: $commit
99120
Directory: $version/$variant/$subVariant
100121
EOE

0 commit comments

Comments
 (0)