mirror of
https://github.com/docker-library/ruby.git
synced 2022-11-09 11:41:34 -05:00
46 lines
1.3 KiB
Bash
Executable file
46 lines
1.3 KiB
Bash
Executable file
#!/bin/bash
|
|
set -e
|
|
|
|
declare -A aliases
|
|
aliases=(
|
|
[2.3]='2 latest'
|
|
)
|
|
|
|
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
|
|
|
|
versions=( */ )
|
|
versions=( "${versions[@]%/}" )
|
|
url='git://github.com/docker-library/ruby'
|
|
|
|
echo '# maintainer: InfoSiftr <github@infosiftr.com> (@infosiftr)'
|
|
|
|
for version in "${versions[@]}"; do
|
|
commit="$(cd "$version" && git log -1 --format='format:%H' -- Dockerfile $(awk 'toupper($1) == "COPY" { for (i = 2; i < NF; i++) { print $i } }' Dockerfile))"
|
|
fullVersion="$(grep -m1 'ENV RUBY_VERSION ' "$version/Dockerfile" | cut -d' ' -f3)"
|
|
|
|
versionAliases=()
|
|
while [ "$fullVersion" != "$version" -a "${fullVersion%[.-]*}" != "$fullVersion" ]; do
|
|
versionAliases+=( $fullVersion )
|
|
fullVersion="${fullVersion%[.-]*}"
|
|
done
|
|
versionAliases+=( $version ${aliases[$version]} )
|
|
|
|
echo
|
|
for va in "${versionAliases[@]}"; do
|
|
echo "$va: ${url}@${commit} $version"
|
|
done
|
|
|
|
for variant in onbuild slim alpine; do
|
|
[ -d "$version/$variant" ] || continue
|
|
commit="$(cd "$version/$variant" && git log -1 --format='format:%H' -- Dockerfile $(awk 'toupper($1) == "COPY" { for (i = 2; i < NF; i++) { print $i } }' Dockerfile))"
|
|
echo
|
|
for va in "${versionAliases[@]}"; do
|
|
if [ "$va" = 'latest' ]; then
|
|
va="$variant"
|
|
else
|
|
va="$va-$variant"
|
|
fi
|
|
echo "$va: ${url}@${commit} $version/$variant"
|
|
done
|
|
done
|
|
done
|