forked from carlossg/docker-maven
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate-stackbrew-library.sh
executable file
·57 lines (45 loc) · 1.37 KB
/
generate-stackbrew-library.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
set -e
latest='jdk-8'
cd "$(dirname "${BASH_SOURCE[0]}")"
url='git://github.com/carlossg/docker-maven'
generate-version() {
local version=$1
local branch=$2
local branch_suffix=""
if [ "$branch" != 'master' ]; then
branch_suffix="-${branch}"
fi
commit="$(git log -1 --format='format:%H' "$branch" -- "$version")"
mavenVersion="$(grep -m1 'ARG MAVEN_VERSION=' "$version/Dockerfile" | cut -d'=' -f2)"
versionAliases=()
while [ "${mavenVersion%[.-]*}" != "$mavenVersion" ]; do
versionAliases+=( $mavenVersion-$version )
if [ "$version" = "$latest" ]; then
versionAliases+=( $mavenVersion )
fi
mavenVersion="${mavenVersion%[.-]*}"
done
versionAliases+=( $mavenVersion-$version )
if [ "$version" = "$latest" ]; then
versionAliases+=( $mavenVersion latest )
fi
echo
for va in "${versionAliases[@]}"; do
if [ "$branch" != 'master' ] && [ "$va" = 'latest' ]; then
echo "${branch}: ${url}@${commit} $version"
else
echo "${va}${branch_suffix}: ${url}@${commit} $version"
fi
done
}
echo '# maintainer: Carlos Sanchez <[email protected]> (@carlossg)'
versions=( jdk-*/ ibmjava-*/ )
versions=( "${versions[@]%/}" )
for version in "${versions[@]}"; do
for branch in master alpine; do
if ! ( [[ "$version" =~ .*-9 ]] && [ "$branch" == 'alpine' ] ); then # no base image for jdk-9-alpine yet
generate-version "$version" "$branch"
fi
done
done