From f5ccd855ad76431bad039d592ea63a4a9db498ff Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 16 Jun 2017 15:26:03 -0700 Subject: [PATCH] Add proper Architectures entries in "generate-stackbrew-library.sh" --- generate-stackbrew-library.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 63022f9cd6..fa8e72d79b 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -32,6 +32,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 'wordpress' + cat <<-EOH # this file is generated via https://github.com/docker-library/wordpress/blob/$(fileCommit "$self")/$self @@ -96,9 +112,13 @@ for phpVersion in "${phpVersions[@]}"; do fullAliases+=( "${phpVersionAliases[@]}" ) fi + variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$dir/Dockerfile")" + variantArches="${parentRepoToArches[$variantParent]}" + echo cat <<-EOE Tags: $(join ', ' "${fullAliases[@]}") + Architectures: $(join ', ' $variantArches) GitCommit: $commit Directory: $dir EOE @@ -148,9 +168,13 @@ for phpVersion in "${phpVersions[@]}"; do "${phpVersionVariantAliases[@]}" ) + variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$dir/Dockerfile")" + variantArches="${parentRepoToArches[$variantParent]}" + echo cat <<-EOE Tags: $(join ', ' "${fullAliases[@]}") + Architectures: $(join ', ' $variantArches) GitCommit: $commit Directory: $dir EOE