1
0
Fork 0
mirror of https://github.com/docker-library/ruby.git synced 2022-11-09 11:41:34 -05:00

Add explicit multiarch support in "generate-stackbrew-library.sh"

This commit is contained in:
Joe Ferguson 2017-06-15 15:49:20 -07:00
parent c5693b25aa
commit 48ad4b7d1c

View file

@ -33,6 +33,22 @@ dirCommit() {
) )
} }
getArches() {
local repo="$1"; shift
local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/'
eval "declare -A -g 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 'ruby'
cat <<-EOH cat <<-EOH
# this file is generated via https://github.com/docker-library/ruby/blob/$(fileCommit "$self")/$self # this file is generated via https://github.com/docker-library/ruby/blob/$(fileCommit "$self")/$self
@ -51,6 +67,9 @@ join() {
for version in "${versions[@]}"; do for version in "${versions[@]}"; do
commit="$(dirCommit "$version")" commit="$(dirCommit "$version")"
parent="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/Dockerfile")"
arches="${parentRepoToArches[$parent]}"
fullVersion="$(git show "$commit":"$version/Dockerfile" | awk '$1 == "ENV" && $2 == "RUBY_VERSION" { print $3; exit }')" fullVersion="$(git show "$commit":"$version/Dockerfile" | awk '$1 == "ENV" && $2 == "RUBY_VERSION" { print $3; exit }')"
versionAliases=( versionAliases=(
@ -62,6 +81,7 @@ for version in "${versions[@]}"; do
echo echo
cat <<-EOE cat <<-EOE
Tags: $(join ', ' "${versionAliases[@]}") Tags: $(join ', ' "${versionAliases[@]}")
Architectures: $(join ', ' $arches)
GitCommit: $commit GitCommit: $commit
Directory: $version Directory: $version
EOE EOE
@ -74,9 +94,18 @@ for version in "${versions[@]}"; do
variantAliases=( "${versionAliases[@]/%/-$variant}" ) variantAliases=( "${versionAliases[@]/%/-$variant}" )
variantAliases=( "${variantAliases[@]//latest-/}" ) variantAliases=( "${variantAliases[@]//latest-/}" )
case "$variant" in
onbuild) variantArches="$arches" ;;
*)
variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/$variant/Dockerfile")"
variantArches="${parentRepoToArches[$variantParent]}"
;;
esac
echo echo
cat <<-EOE cat <<-EOE
Tags: $(join ', ' "${variantAliases[@]}") Tags: $(join ', ' "${variantAliases[@]}")
Architectures: $(join ', ' $variantArches)
GitCommit: $commit GitCommit: $commit
Directory: $version/$variant Directory: $version/$variant
EOE EOE