2015-07-25 18:42:58 +00:00
|
|
|
#!/bin/bash
|
2016-08-16 12:14:03 +00:00
|
|
|
set -eu
|
2015-07-25 18:42:58 +00:00
|
|
|
|
2016-08-16 12:14:03 +00:00
|
|
|
self="$(basename "$BASH_SOURCE")"
|
2015-07-25 18:42:58 +00:00
|
|
|
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
|
|
|
|
|
2016-08-16 12:14:03 +00:00
|
|
|
# get the most recent commit which modified any of "$@"
|
|
|
|
fileCommit() {
|
|
|
|
git log -1 --format='format:%H' HEAD -- "$@"
|
|
|
|
}
|
2015-07-25 18:42:58 +00:00
|
|
|
|
2016-08-16 12:14:03 +00:00
|
|
|
# get the most recent commit which modified "$1/Dockerfile" or any file COPY'd from "$1/Dockerfile"
|
|
|
|
dirCommit() {
|
|
|
|
local dir="$1"; shift
|
|
|
|
(
|
|
|
|
cd "$dir"
|
|
|
|
fileCommit \
|
|
|
|
Dockerfile \
|
|
|
|
$(git show HEAD:./Dockerfile | awk '
|
|
|
|
toupper($1) == "COPY" {
|
|
|
|
for (i = 2; i < NF; i++) {
|
|
|
|
print $i
|
|
|
|
}
|
|
|
|
}
|
|
|
|
')
|
|
|
|
)
|
|
|
|
}
|
2015-07-25 18:42:58 +00:00
|
|
|
|
2016-08-16 12:14:03 +00:00
|
|
|
cat <<-EOH
|
|
|
|
# this file is generated via https://github.com/joomla/docker-joomla/blob/$(fileCommit "$self")/$self
|
|
|
|
|
|
|
|
Maintainers: Michael Babker <michael.babker@joomla.org> (@mbabker)
|
|
|
|
GitRepo: https://github.com/joomla/docker-joomla.git
|
|
|
|
EOH
|
|
|
|
|
|
|
|
# prints "$2$1$3$1...$N"
|
|
|
|
join() {
|
|
|
|
local sep="$1"; shift
|
|
|
|
local out; printf -v out "${sep//%/%%}%s" "$@"
|
|
|
|
echo "${out#$sep}"
|
|
|
|
}
|
2015-07-25 18:42:58 +00:00
|
|
|
|
2018-02-13 01:28:50 +00:00
|
|
|
for variant in apache apache-php7.0 apache-php7.1 apache-php7.2 fpm fpm-alpine fpm-php7.0 fpm-php7.0-alpine fpm-php7.1 fpm-php7.1-alpine fpm-php7.2 fpm-php7.2-alpine; do
|
2016-08-16 12:14:03 +00:00
|
|
|
commit="$(dirCommit "$variant")"
|
|
|
|
|
|
|
|
fullVersion="$(git show "$commit":"$variant/Dockerfile" | awk '$1 == "ENV" && $2 == "JOOMLA_VERSION" { print $3; exit }')"
|
|
|
|
if [[ "$fullVersion" != *.*.* && "$fullVersion" == *.* ]]; then
|
|
|
|
fullVersion+='.0'
|
|
|
|
fi
|
2015-07-25 18:42:58 +00:00
|
|
|
|
|
|
|
versionAliases=()
|
|
|
|
while [ "${fullVersion%.*}" != "$fullVersion" ]; do
|
2016-08-16 12:14:03 +00:00
|
|
|
versionAliases+=( $fullVersion )
|
2015-07-25 18:42:58 +00:00
|
|
|
fullVersion="${fullVersion%.*}"
|
|
|
|
done
|
2016-08-16 12:14:03 +00:00
|
|
|
versionAliases+=(
|
|
|
|
$fullVersion
|
|
|
|
latest
|
|
|
|
)
|
|
|
|
|
|
|
|
variantAliases=( "${versionAliases[@]/%/-$variant}" )
|
|
|
|
variantAliases=( "${variantAliases[@]//latest-/}" )
|
|
|
|
|
|
|
|
if [ "$variant" = 'apache' ]; then
|
|
|
|
variantAliases+=( "${versionAliases[@]}" )
|
2015-07-25 18:42:58 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo
|
2016-08-16 12:14:03 +00:00
|
|
|
cat <<-EOE
|
|
|
|
Tags: $(join ', ' "${variantAliases[@]}")
|
|
|
|
GitCommit: $commit
|
|
|
|
Directory: $variant
|
|
|
|
EOE
|
2015-07-25 18:42:58 +00:00
|
|
|
done
|