Merge pull request #41 from infosiftr/multiarch

Add proper Architectures entries in "generate-stackbrew-library.sh"
This commit is contained in:
yosifkit authored and GitHub committed 2017-06-12 10:38:13 -07:00
commit 0a2de11c75
1 file changed
+24
+24
View File
@@ -33,6 +33,22 @@ dirCommit() {
)
}
getArches() {
local repo="$1"; shift
local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/'
eval "declare -g -A parentRepoToArches=( $(
find -name 'Dockerfile' -exec awk '
toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|microsoft\/[^:]+)(:|$)/ {
print "'"$officialImagesUrl"'" $2
}
' '{}' + \
| sort -u \
| xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
) )"
}
getArches 'haproxy'
cat <<-EOH
# this file is generated via https://github.com/docker-library/haproxy/blob/$(fileCommit "$self")/$self
@@ -59,9 +75,13 @@ for version in "${versions[@]}"; do
${aliases[$version]:-}
)
parent="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/Dockerfile")"
arches="${parentRepoToArches[$parent]}"
echo
cat <<-EOE
Tags: $(join ', ' "${versionAliases[@]}")
Architectures: $(join ', ' $arches)
GitCommit: $commit
Directory: $version
EOE
@@ -74,9 +94,13 @@ for version in "${versions[@]}"; do
variantAliases=( "${versionAliases[@]/%/-$variant}" )
variantAliases=( "${variantAliases[@]//latest-/}" )
variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/$variant/Dockerfile")"
variantArches="${parentRepoToArches[$variantParent]}"
echo
cat <<-EOE
Tags: $(join ', ' "${variantAliases[@]}")
Architectures: $(join ', ' $variantArches)
GitCommit: $commit
Directory: $version/$variant
EOE