mirror of
https://github.com/joomla-docker/docker-joomla.git
synced 2025-01-10 08:34:04 +00:00
commit
34536c8941
24
.travis.yml
24
.travis.yml
@ -2,18 +2,18 @@ language: bash
|
|||||||
services: docker
|
services: docker
|
||||||
|
|
||||||
env:
|
env:
|
||||||
- VARIANT=apache
|
- VARIANT=php5.6/apache
|
||||||
- VARIANT=apache-php7.0
|
- VARIANT=php7.0/apache
|
||||||
- VARIANT=apache-php7.1
|
- VARIANT=php7.1/apache
|
||||||
- VARIANT=apache-php7.2
|
- VARIANT=php7.2/apache
|
||||||
- VARIANT=fpm
|
- VARIANT=php5.6/fpm
|
||||||
- VARIANT=fpm-alpine
|
- VARIANT=php7.0/fpm
|
||||||
- VARIANT=fpm-php7.0
|
- VARIANT=php7.1/fpm
|
||||||
- VARIANT=fpm-php7.0-alpine
|
- VARIANT=php7.2/fpm
|
||||||
- VARIANT=fpm-php7.1
|
- VARIANT=php5.6/fpm-alpine
|
||||||
- VARIANT=fpm-php7.1-alpine
|
- VARIANT=php7.0/fpm-alpine
|
||||||
- VARIANT=fpm-php7.2
|
- VARIANT=php7.1/fpm-alpine
|
||||||
- VARIANT=fpm-php7.2-alpine
|
- VARIANT=php7.2/fpm-alpine
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- git clone https://github.com/docker-library/official-images.git ~/official-images
|
- git clone https://github.com/docker-library/official-images.git ~/official-images
|
||||||
|
@ -1,9 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
|
# Latest available version based on https://downloads.joomla.org/technical-requirements - PHP 7.1 due to known 7.2 bugs still present
|
||||||
|
defaultPhpVersion='php7.1'
|
||||||
|
defaultVariant='apache'
|
||||||
|
|
||||||
self="$(basename "$BASH_SOURCE")"
|
self="$(basename "$BASH_SOURCE")"
|
||||||
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
|
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
|
||||||
|
|
||||||
|
phpVersions=( php*.*/ )
|
||||||
|
phpVersions=( "${phpVersions[@]%/}" )
|
||||||
|
|
||||||
# get the most recent commit which modified any of "$@"
|
# get the most recent commit which modified any of "$@"
|
||||||
fileCommit() {
|
fileCommit() {
|
||||||
git log -1 --format='format:%H' HEAD -- "$@"
|
git log -1 --format='format:%H' HEAD -- "$@"
|
||||||
@ -40,35 +47,62 @@ join() {
|
|||||||
echo "${out#$sep}"
|
echo "${out#$sep}"
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
for phpVersion in "${phpVersions[@]}"; do
|
||||||
commit="$(dirCommit "$variant")"
|
for variant in apache fpm fpm-alpine; do
|
||||||
|
dir="$phpVersion/$variant"
|
||||||
|
[ -f "$dir/Dockerfile" ] || continue
|
||||||
|
|
||||||
fullVersion="$(git show "$commit":"$variant/Dockerfile" | awk '$1 == "ENV" && $2 == "JOOMLA_VERSION" { print $3; exit }')"
|
commit="$(dirCommit "$dir")"
|
||||||
if [[ "$fullVersion" != *.*.* && "$fullVersion" == *.* ]]; then
|
|
||||||
fullVersion+='.0'
|
|
||||||
fi
|
|
||||||
|
|
||||||
versionAliases=()
|
fullVersion="$(git show "$commit":"$dir/Dockerfile" | awk '$1 == "ENV" && $2 == "JOOMLA_VERSION" { print $3; exit }')"
|
||||||
while [ "${fullVersion%.*}" != "$fullVersion" ]; do
|
if [[ "$fullVersion" != *.*.* && "$fullVersion" == *.* ]]; then
|
||||||
versionAliases+=( $fullVersion )
|
fullVersion+='.0'
|
||||||
fullVersion="${fullVersion%.*}"
|
fi
|
||||||
|
|
||||||
|
versionAliases=()
|
||||||
|
while [ "${fullVersion%[.-]*}" != "$fullVersion" ]; do
|
||||||
|
versionAliases+=( $fullVersion )
|
||||||
|
fullVersion="${fullVersion%[.-]*}"
|
||||||
|
done
|
||||||
|
versionAliases+=(
|
||||||
|
$fullVersion
|
||||||
|
latest
|
||||||
|
)
|
||||||
|
|
||||||
|
phpVersionAliases=( "${versionAliases[@]/%/-$phpVersion}" )
|
||||||
|
phpVersionAliases=( "${phpVersionAliases[@]//latest-/}" )
|
||||||
|
|
||||||
|
variantAliases=( "${versionAliases[@]/%/-$variant}" )
|
||||||
|
variantAliases=( "${variantAliases[@]//latest-/}" )
|
||||||
|
|
||||||
|
phpVersionVariantAliases=( "${versionAliases[@]/%/-$phpVersion-$variant}" )
|
||||||
|
phpVersionVariantAliases=( "${phpVersionVariantAliases[@]//latest-/}" )
|
||||||
|
|
||||||
|
fullAliases=()
|
||||||
|
|
||||||
|
if [ "$phpVersion" = "$defaultPhpVersion" ]; then
|
||||||
|
fullAliases+=( "${variantAliases[@]}" )
|
||||||
|
|
||||||
|
if [ "$variant" = "$defaultVariant" ]; then
|
||||||
|
fullAliases+=( "${versionAliases[@]}" )
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
fullAliases+=(
|
||||||
|
"${phpVersionVariantAliases[@]}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if [ "$variant" = "$defaultVariant" ]; then
|
||||||
|
fullAliases+=( "${phpVersionAliases[@]}" )
|
||||||
|
fi
|
||||||
|
|
||||||
|
variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$dir/Dockerfile")"
|
||||||
|
|
||||||
|
echo
|
||||||
|
cat <<-EOE
|
||||||
|
Tags: $(join ', ' "${fullAliases[@]}")
|
||||||
|
GitCommit: $commit
|
||||||
|
Directory: $dir
|
||||||
|
EOE
|
||||||
done
|
done
|
||||||
versionAliases+=(
|
|
||||||
$fullVersion
|
|
||||||
latest
|
|
||||||
)
|
|
||||||
|
|
||||||
variantAliases=( "${versionAliases[@]/%/-$variant}" )
|
|
||||||
variantAliases=( "${variantAliases[@]//latest-/}" )
|
|
||||||
|
|
||||||
if [ "$variant" = 'apache' ]; then
|
|
||||||
variantAliases+=( "${versionAliases[@]}" )
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
cat <<-EOE
|
|
||||||
Tags: $(join ', ' "${variantAliases[@]}")
|
|
||||||
GitCommit: $commit
|
|
||||||
Directory: $variant
|
|
||||||
EOE
|
|
||||||
done
|
done
|
||||||
|
33
update.php
33
update.php
@ -73,19 +73,34 @@ if (!isset($signature))
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (['apache', 'apache-php7.0', 'apache-php7.1', 'apache-php7.2', 'fpm', 'fpm-php7.0', 'fpm-php7.1', 'fpm-php7.2'] as $variant)
|
$phpVersions = [];
|
||||||
|
$platforms = ['apache', 'fpm', 'fpm-alpine'];
|
||||||
|
|
||||||
|
/** @var DirectoryIterator $dir */
|
||||||
|
foreach (new DirectoryIterator(__DIR__) as $dir)
|
||||||
{
|
{
|
||||||
$dockerfile = __DIR__ . "/$variant/Dockerfile";
|
if (substr($dir->getFilename(), 0, 3) === 'php')
|
||||||
|
{
|
||||||
|
$phpVersions[] = $dir->getFilename();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$fileContents = file_get_contents($dockerfile);
|
foreach ($phpVersions as $phpVersion)
|
||||||
$fileContents = preg_replace('#ENV JOOMLA_VERSION [^ ]*\n#', "ENV JOOMLA_VERSION $version\n", $fileContents);
|
{
|
||||||
$fileContents = preg_replace('#ENV JOOMLA_SHA1 [^ ]*\n#', "ENV JOOMLA_SHA1 $signature\n\n", $fileContents);
|
foreach ($platforms as $platform)
|
||||||
|
{
|
||||||
|
$dockerfile = __DIR__ . "/$phpVersion/$platform/Dockerfile";
|
||||||
|
|
||||||
file_put_contents($dockerfile, $fileContents);
|
$fileContents = file_get_contents($dockerfile);
|
||||||
|
$fileContents = preg_replace('#ENV JOOMLA_VERSION [^ ]*\n#', "ENV JOOMLA_VERSION $version\n", $fileContents);
|
||||||
|
$fileContents = preg_replace('#ENV JOOMLA_SHA1 [^ ]*\n#', "ENV JOOMLA_SHA1 $signature\n\n", $fileContents);
|
||||||
|
|
||||||
// To make management easier, we use these files for all variants
|
file_put_contents($dockerfile, $fileContents);
|
||||||
copy(__DIR__ . '/docker-entrypoint.sh', __DIR__ . "/$variant/docker-entrypoint.sh");
|
|
||||||
copy(__DIR__ . '/makedb.php', __DIR__ . "/$variant/makedb.php");
|
// To make management easier, we use these files for all variants
|
||||||
|
copy(__DIR__ . '/docker-entrypoint.sh', __DIR__ . "/$phpVersion/$platform/docker-entrypoint.sh");
|
||||||
|
copy(__DIR__ . '/makedb.php', __DIR__ . "/$phpVersion/$platform/makedb.php");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo 'Dockerfile variants updated' . PHP_EOL;
|
echo 'Dockerfile variants updated' . PHP_EOL;
|
||||||
|
Loading…
Reference in New Issue
Block a user