Skip to content

Commit 0be13f0

Browse files
authored
Merge pull request docker-library#206 from infosiftr/archy
Add explicit multiarch support in "generate-stackbrew-library.sh"
2 parents 6d31b8c + 8baafd1 commit 0be13f0

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

generate-stackbrew-library.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ dirCommit() {
3535
)
3636
}
3737

38+
getArches() {
39+
local repo="$1"; shift
40+
local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/'
41+
42+
eval "declare -A -g parentRepoToArches=( $(
43+
find -name 'Dockerfile' -exec awk '
44+
toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|microsoft\/[^:]+)(:|$)/ {
45+
print "'"$officialImagesUrl"'" $2
46+
}
47+
' '{}' + \
48+
| sort -u \
49+
| xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
50+
) )"
51+
}
52+
getArches 'python'
53+
3854
cat <<-EOH
3955
# this file is generated via https://github.com/docker-library/python/blob/$(fileCommit "$self")/$self
4056
@@ -53,6 +69,9 @@ join() {
5369
for version in "${versions[@]}"; do
5470
commit="$(dirCommit "$version")"
5571

72+
parent="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/Dockerfile")"
73+
arches="${parentRepoToArches[$parent]}"
74+
5675
fullVersion="$(git show "$commit":"$version/Dockerfile" | awk '$1 == "ENV" && $2 == "PYTHON_VERSION" { print $3; exit }')"
5776

5877
versionAliases=(
@@ -64,6 +83,7 @@ for version in "${versions[@]}"; do
6483
echo
6584
cat <<-EOE
6685
Tags: $(join ', ' "${versionAliases[@]}")
86+
Architectures: $(join ', ' $arches)
6787
GitCommit: $commit
6888
Directory: $version
6989
EOE
@@ -82,9 +102,19 @@ for version in "${versions[@]}"; do
82102
variantAliases=( "${versionAliases[@]/%/-$variant}" )
83103
variantAliases=( "${variantAliases[@]//latest-/}" )
84104

105+
case "$v" in
106+
windows/*) variantArches='windows-amd64' ;;
107+
onbuild) variantArches="$arches" ;;
108+
*)
109+
variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/$v/Dockerfile")"
110+
variantArches="${parentRepoToArches[$variantParent]}"
111+
;;
112+
esac
113+
85114
echo
86115
cat <<-EOE
87116
Tags: $(join ', ' "${variantAliases[@]}")
117+
Architectures: $(join ', ' $variantArches)
88118
GitCommit: $commit
89119
Directory: $dir
90120
EOE

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy