From 8d1ed041ef46982fe5a15bed9e662c0045b23c75 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 24 Aug 2017 13:05:52 -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 faaec5d1..99b6bc6f 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -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 'ghost' + cat <<-EOH # this file is generated via https://github.com/docker-library/ghost/blob/$(fileCommit "$self")/$self @@ -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