From 8df795c4dc6619e97e5d4fd94731703e6a01355e Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 12 Jun 2017 09:29:49 -0700 Subject: [PATCH] Add proper Architectures entries in "generate-stackbrew-library.sh" --- generate-stackbrew-library.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index c0df61920..cba376199 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -41,6 +41,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 'tomcat' + cat <<-EOH # this file is generated via https://github.com/docker-library/tomcat/blob/$(fileCommit "$self")/$self @@ -88,9 +104,13 @@ for version in "${versions[@]}"; do variantAliases+=( "${subVariantAliases[@]}" ) 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