From 2430a6303900e37f6a0fb944059d65ddbdd7d61b Mon Sep 17 00:00:00 2001 From: J0WI Date: Wed, 14 Feb 2018 02:48:51 +0100 Subject: [PATCH] Add architecture (fix #30) --- generate-stackbrew-library.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 8b84545..e064eca 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -33,6 +33,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 'joomla' + cat <<-EOH # this file is generated via https://github.com/joomla/docker-joomla/blob/$(fileCommit "$self")/$self @@ -97,10 +113,12 @@ for phpVersion in "${phpVersions[@]}"; do 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