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
|
||||
|
||||
env:
|
||||
- VARIANT=apache
|
||||
- VARIANT=apache-php7.0
|
||||
- VARIANT=apache-php7.1
|
||||
- VARIANT=apache-php7.2
|
||||
- VARIANT=fpm
|
||||
- VARIANT=fpm-alpine
|
||||
- VARIANT=fpm-php7.0
|
||||
- VARIANT=fpm-php7.0-alpine
|
||||
- VARIANT=fpm-php7.1
|
||||
- VARIANT=fpm-php7.1-alpine
|
||||
- VARIANT=fpm-php7.2
|
||||
- VARIANT=fpm-php7.2-alpine
|
||||
- VARIANT=php5.6/apache
|
||||
- VARIANT=php7.0/apache
|
||||
- VARIANT=php7.1/apache
|
||||
- VARIANT=php7.2/apache
|
||||
- VARIANT=php5.6/fpm
|
||||
- VARIANT=php7.0/fpm
|
||||
- VARIANT=php7.1/fpm
|
||||
- VARIANT=php7.2/fpm
|
||||
- VARIANT=php5.6/fpm-alpine
|
||||
- VARIANT=php7.0/fpm-alpine
|
||||
- VARIANT=php7.1/fpm-alpine
|
||||
- VARIANT=php7.2/fpm-alpine
|
||||
|
||||
install:
|
||||
- git clone https://github.com/docker-library/official-images.git ~/official-images
|
||||
|
@ -1,9 +1,16 @@
|
||||
#!/bin/bash
|
||||
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")"
|
||||
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
|
||||
|
||||
phpVersions=( php*.*/ )
|
||||
phpVersions=( "${phpVersions[@]%/}" )
|
||||
|
||||
# get the most recent commit which modified any of "$@"
|
||||
fileCommit() {
|
||||
git log -1 --format='format:%H' HEAD -- "$@"
|
||||
@ -40,35 +47,62 @@ join() {
|
||||
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
|
||||
commit="$(dirCommit "$variant")"
|
||||
for phpVersion in "${phpVersions[@]}"; do
|
||||
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")"
|
||||
|
||||
fullVersion="$(git show "$commit":"$dir/Dockerfile" | awk '$1 == "ENV" && $2 == "JOOMLA_VERSION" { print $3; exit }')"
|
||||
if [[ "$fullVersion" != *.*.* && "$fullVersion" == *.* ]]; then
|
||||
fullVersion+='.0'
|
||||
fi
|
||||
|
||||
versionAliases=()
|
||||
while [ "${fullVersion%.*}" != "$fullVersion" ]; do
|
||||
while [ "${fullVersion%[.-]*}" != "$fullVersion" ]; do
|
||||
versionAliases+=( $fullVersion )
|
||||
fullVersion="${fullVersion%.*}"
|
||||
fullVersion="${fullVersion%[.-]*}"
|
||||
done
|
||||
versionAliases+=(
|
||||
$fullVersion
|
||||
latest
|
||||
)
|
||||
|
||||
phpVersionAliases=( "${versionAliases[@]/%/-$phpVersion}" )
|
||||
phpVersionAliases=( "${phpVersionAliases[@]//latest-/}" )
|
||||
|
||||
variantAliases=( "${versionAliases[@]/%/-$variant}" )
|
||||
variantAliases=( "${variantAliases[@]//latest-/}" )
|
||||
|
||||
if [ "$variant" = 'apache' ]; then
|
||||
variantAliases+=( "${versionAliases[@]}" )
|
||||
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 ', ' "${variantAliases[@]}")
|
||||
Tags: $(join ', ' "${fullAliases[@]}")
|
||||
GitCommit: $commit
|
||||
Directory: $variant
|
||||
Directory: $dir
|
||||
EOE
|
||||
done
|
||||
done
|
||||
|
23
update.php
23
update.php
@ -73,9 +73,23 @@ if (!isset($signature))
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($phpVersions as $phpVersion)
|
||||
{
|
||||
foreach ($platforms as $platform)
|
||||
{
|
||||
$dockerfile = __DIR__ . "/$phpVersion/$platform/Dockerfile";
|
||||
|
||||
$fileContents = file_get_contents($dockerfile);
|
||||
$fileContents = preg_replace('#ENV JOOMLA_VERSION [^ ]*\n#', "ENV JOOMLA_VERSION $version\n", $fileContents);
|
||||
@ -84,8 +98,9 @@ foreach (['apache', 'apache-php7.0', 'apache-php7.1', 'apache-php7.2', 'fpm', 'f
|
||||
file_put_contents($dockerfile, $fileContents);
|
||||
|
||||
// To make management easier, we use these files for all variants
|
||||
copy(__DIR__ . '/docker-entrypoint.sh', __DIR__ . "/$variant/docker-entrypoint.sh");
|
||||
copy(__DIR__ . '/makedb.php', __DIR__ . "/$variant/makedb.php");
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user