diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 30c11ca3..45da8b14 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -25,6 +25,22 @@ dockerfileCommit() { ) } +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 /home/admin/prog/docker/official-images/bashbrew/go/bin/bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"' + ) )" +} +getArches 'piwik' + # Header. cat <<-EOH # This file is generated via https://github.com/piwik/docker-piwik/blob/$(fileCommit "$self")/$self @@ -66,9 +82,13 @@ for variant in "${variants[@]}"; do variantAliases+=( "${versionAliases[@]}" ) fi + variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$variant/Dockerfile")" + variantArches="${parentRepoToArches[$variantParent]}" + cat <<-EOE Tags: $(join ', ' "${variantAliases[@]}") + Architectures: $(join ', ' $variantArches) GitCommit: $commit Directory: $variant EOE