Skip to content

Commit

Permalink
Add Architectures (fix matomo-org#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
J0WI committed Feb 21, 2018
1 parent 3449236 commit 1f7da24
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1f7da24

Please sign in to comment.