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

Merge pull request #8 from infosiftr/stackbrew

Script for stackbrew and updating, fix 1.9 onbuild FROM line
This commit is contained in:
Tianon Gravi 2014-08-14 14:44:57 -07:00
commit bf13136882
3 changed files with 69 additions and 1 deletions

View file

@ -1,4 +1,4 @@
FROM ruby:1.9.3
FROM ruby:1.9.3-p547
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

44
generate-stackbrew-library.sh Executable file
View file

@ -0,0 +1,44 @@
#!/bin/bash
set -e
declare -A aliases
aliases=(
[2.1]='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="$(git log -1 --format='format:%H' "$version")"
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; do
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

24
update.sh Executable file
View file

@ -0,0 +1,24 @@
#!/bin/bash
set -e
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
versions=( "$@" )
if [ ${#versions[@]} -eq 0 ]; then
versions=( */ )
fi
versions=( "${versions[@]%/}" )
for version in "${versions[@]}"; do
fullVersion="$(curl -sSL "http://cache.ruby-lang.org/pub/ruby/$version/" \
| grep -E '<a href="ruby-'"$version"'.[^"]+\.tar\.bz2' \
| grep -vE 'preview|rc' \
| sed -r 's!.*<a href="ruby-([^"]+)\.tar\.bz2.*!\1!' \
| sort -V | tail -1)"
(
set -x
sed -ri 's/^(ENV RUBY_MAJOR) .*/\1 '"$version"'/' "$version/Dockerfile"
sed -ri 's/^(ENV RUBY_VERSION) .*/\1 '"$fullVersion"'/' "$version/Dockerfile"
sed -ri 's/^(FROM ruby):.*/\1:'"$fullVersion"'/' "$version/"*"/Dockerfile"
)
done