Skip to content

Commit

Permalink
Merge pull request #167 from infosiftr/multiarch
Browse files Browse the repository at this point in the history
Add proper Architectures entries in "generate-stackbrew-library.sh"
  • Loading branch information
tianon authored Jun 19, 2017
2 parents 2a73673 + 9106c7d commit 0797005
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,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 'rabbitmq'

cat <<-EOH
# this file is generated via https://github.com/docker-library/rabbitmq/blob/$(fileCommit "$self")/$self
Expand Down Expand Up @@ -75,9 +91,13 @@ for version in "${versions[@]}"; do
variantAliases=( "${variantAliases[@]//latest-/}" )
fi

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
Expand All @@ -95,6 +115,7 @@ for version in "${versions[@]}"; do
echo
cat <<-EOE
Tags: $(join ', ' "${subVariantAliases[@]}")
Architectures: $(join ', ' $variantArches)
GitCommit: $commit
Directory: $version/$variant/$subVariant
EOE
Expand Down

0 comments on commit 0797005

Please sign in to comment.