mirror of
https://github.com/devilbox/docker-php-fpm.git
synced 2025-12-12 12:01:14 +00:00
Variablize Docker platform
This commit is contained in:
12
Makefile
12
Makefile
@@ -149,13 +149,13 @@ lint-yaml:
|
|||||||
gen-readme:
|
gen-readme:
|
||||||
ifeq ($(strip $(VERSION)),)
|
ifeq ($(strip $(VERSION)),)
|
||||||
@echo "Generate README.md for all PHP versions"
|
@echo "Generate README.md for all PHP versions"
|
||||||
cd build; ./gen-readme.sh
|
cd build; ./gen-readme.sh $(ARCH)
|
||||||
else
|
else
|
||||||
@echo "Generate README.md for PHP $(VERSION)"
|
@echo "Generate README.md for PHP $(VERSION)"
|
||||||
@$(MAKE) --no-print-directory _check-version
|
@$(MAKE) --no-print-directory _check-version
|
||||||
@$(MAKE) --no-print-directory _check-image-exists _EXIST_IMAGE=base
|
@$(MAKE) --no-print-directory _check-image-exists _EXIST_IMAGE=base
|
||||||
@$(MAKE) --no-print-directory _check-image-exists _EXIST_IMAGE=mods
|
@$(MAKE) --no-print-directory _check-image-exists _EXIST_IMAGE=mods
|
||||||
cd build; ./gen-readme.sh $(VERSION)
|
cd build; ./gen-readme.sh $(ARCH) $(VERSION)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
gen-dockerfiles:
|
gen-dockerfiles:
|
||||||
@@ -286,28 +286,28 @@ test-base: _check-version
|
|||||||
test-base: _EXIST_IMAGE=base
|
test-base: _EXIST_IMAGE=base
|
||||||
test-base: _check-image-exists
|
test-base: _check-image-exists
|
||||||
test-base:
|
test-base:
|
||||||
./tests/test.sh ${VERSION} base
|
./tests/test.sh $(IMAGE) $(ARCH) $(VERSION) base
|
||||||
|
|
||||||
|
|
||||||
test-mods: _check-version
|
test-mods: _check-version
|
||||||
test-mods: _EXIST_IMAGE=mods
|
test-mods: _EXIST_IMAGE=mods
|
||||||
test-mods: _check-image-exists
|
test-mods: _check-image-exists
|
||||||
test-mods: _check-version
|
test-mods: _check-version
|
||||||
./tests/test.sh ${VERSION} mods
|
./tests/test.sh $(IMAGE) $(ARCH) $(VERSION) mods
|
||||||
|
|
||||||
|
|
||||||
test-prod: _check-version
|
test-prod: _check-version
|
||||||
test-prod: _EXIST_IMAGE=prod
|
test-prod: _EXIST_IMAGE=prod
|
||||||
test-prod: _check-image-exists
|
test-prod: _check-image-exists
|
||||||
test-prod: _check-version
|
test-prod: _check-version
|
||||||
./tests/test.sh ${VERSION} prod
|
./tests/test.sh $(IMAGE) $(ARCH) $(VERSION) prod
|
||||||
|
|
||||||
|
|
||||||
test-work: _check-version
|
test-work: _check-version
|
||||||
test-work: _EXIST_IMAGE=work
|
test-work: _EXIST_IMAGE=work
|
||||||
test-work: _check-image-exists
|
test-work: _check-image-exists
|
||||||
test-work: _check-version
|
test-work: _check-version
|
||||||
./tests/test.sh ${VERSION} work
|
./tests/test.sh $(IMAGE) $(ARCH) $(VERSION) work
|
||||||
|
|
||||||
|
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -8,25 +8,27 @@ set -o pipefail
|
|||||||
# Get absolute directory of this script
|
# Get absolute directory of this script
|
||||||
CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
|
CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
|
||||||
|
|
||||||
|
ARCH="${1:-linux/amd64}"
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
### Show Usage
|
### Show Usage
|
||||||
###
|
###
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "Usage: gen-readme.sh"
|
echo "Usage: gen-readme.sh [<ARCH>]"
|
||||||
echo " gen-readme.sh 5.2"
|
echo " gen-readme.sh <ARCH> 5.2"
|
||||||
echo " gen-readme.sh 5.3"
|
echo " gen-readme.sh <ARCH> 5.3"
|
||||||
echo " gen-readme.sh 5.4"
|
echo " gen-readme.sh <ARCH> 5.4"
|
||||||
echo " gen-readme.sh 5.5"
|
echo " gen-readme.sh <ARCH> 5.5"
|
||||||
echo " gen-readme.sh 5.6"
|
echo " gen-readme.sh <ARCH> 5.6"
|
||||||
echo " gen-readme.sh 7.0"
|
echo " gen-readme.sh <ARCH> 7.0"
|
||||||
echo " gen-readme.sh 7.1"
|
echo " gen-readme.sh <ARCH> 7.1"
|
||||||
echo " gen-readme.sh 7.2"
|
echo " gen-readme.sh <ARCH> 7.2"
|
||||||
echo " gen-readme.sh 7.3"
|
echo " gen-readme.sh <ARCH> 7.3"
|
||||||
echo " gen-readme.sh 7.4"
|
echo " gen-readme.sh <ARCH> 7.4"
|
||||||
echo " gen-readme.sh 8.0"
|
echo " gen-readme.sh <ARCH> 8.0"
|
||||||
echo " gen-readme.sh 8.1"
|
echo " gen-readme.sh <ARCH> 8.1"
|
||||||
echo " gen-readme.sh 8.2"
|
echo " gen-readme.sh <ARCH> 8.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -37,22 +39,22 @@ get_modules() {
|
|||||||
tag="${1}"
|
tag="${1}"
|
||||||
|
|
||||||
# Retrieve all modules
|
# Retrieve all modules
|
||||||
PHP_MODULES="$( docker run --rm $(tty -s && echo '-it' || echo) --entrypoint=php devilbox/php-fpm:${tag} -m )"
|
PHP_MODULES="$( docker run --rm --platform "${ARCH}" $(tty -s && echo '-it' || echo) --entrypoint=php devilbox/php-fpm:${tag} -m )"
|
||||||
ALL_MODULES=
|
ALL_MODULES=
|
||||||
|
|
||||||
if docker run --rm $(tty -s && echo '-it' || echo) --entrypoint=find devilbox/php-fpm:${tag} /usr/local/lib/php/extensions -name 'ioncube.so' | grep -q ioncube.so; then
|
if docker run --rm --platform "${ARCH}" $(tty -s && echo '-it' || echo) --entrypoint=find devilbox/php-fpm:${tag} /usr/local/lib/php/extensions -name 'ioncube.so' | grep -q ioncube.so; then
|
||||||
ALL_MODULES="${ALL_MODULES},ioncube";
|
ALL_MODULES="${ALL_MODULES},ioncube";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if docker run --rm $(tty -s && echo '-it' || echo) --entrypoint=find devilbox/php-fpm:${tag} /usr/local/lib/php/extensions -name 'blackfire.so' | grep -q blackfire.so; then
|
if docker run --rm --platform "${ARCH}" $(tty -s && echo '-it' || echo) --entrypoint=find devilbox/php-fpm:${tag} /usr/local/lib/php/extensions -name 'blackfire.so' | grep -q blackfire.so; then
|
||||||
ALL_MODULES="${ALL_MODULES},blackfire";
|
ALL_MODULES="${ALL_MODULES},blackfire";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if docker run --rm $(tty -s && echo '-it' || echo) --entrypoint=find devilbox/php-fpm:${tag} /usr/local/lib/php/extensions -name 'psr.so' | grep -q psr.so; then
|
if docker run --rm --platform "${ARCH}" $(tty -s && echo '-it' || echo) --entrypoint=find devilbox/php-fpm:${tag} /usr/local/lib/php/extensions -name 'psr.so' | grep -q psr.so; then
|
||||||
ALL_MODULES="${ALL_MODULES},psr";
|
ALL_MODULES="${ALL_MODULES},psr";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if docker run --rm $(tty -s && echo '-it' || echo) --entrypoint=find devilbox/php-fpm:${tag} /usr/local/lib/php/extensions -name 'phalcon.so' | grep -q phalcon.so; then
|
if docker run --rm --platform "${ARCH}" $(tty -s && echo '-it' || echo) --entrypoint=find devilbox/php-fpm:${tag} /usr/local/lib/php/extensions -name 'phalcon.so' | grep -q phalcon.so; then
|
||||||
ALL_MODULES="${ALL_MODULES},phalcon";
|
ALL_MODULES="${ALL_MODULES},phalcon";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -91,7 +93,7 @@ update_readme() {
|
|||||||
###
|
###
|
||||||
### Entrypoint
|
### Entrypoint
|
||||||
###
|
###
|
||||||
if [ "${#}" -eq "0" ]; then
|
if [ "${#}" -eq "0" ] || [ "${#}" -eq "1" ]; then
|
||||||
# Update PHP modules for all versions at once
|
# Update PHP modules for all versions at once
|
||||||
update_readme "5.2"
|
update_readme "5.2"
|
||||||
update_readme "5.3"
|
update_readme "5.3"
|
||||||
@@ -106,31 +108,31 @@ if [ "${#}" -eq "0" ]; then
|
|||||||
update_readme "8.0"
|
update_readme "8.0"
|
||||||
update_readme "8.1"
|
update_readme "8.1"
|
||||||
update_readme "8.2"
|
update_readme "8.2"
|
||||||
elif [ "${#}" -gt "1" ]; then
|
elif [ "${#}" -gt "2" ]; then
|
||||||
# Specifying more than 1 argument is wrong
|
# Specifying more than 1 argument is wrong
|
||||||
echo "Error, invalid number of arguments."
|
echo "Error, invalid number of arguments."
|
||||||
print_usage
|
print_usage
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
if [ "${1}" != "5.2" ] \
|
if [ "${2}" != "5.2" ] \
|
||||||
&& [ "${1}" != "5.3" ] \
|
&& [ "${2}" != "5.3" ] \
|
||||||
&& [ "${1}" != "5.4" ] \
|
&& [ "${2}" != "5.4" ] \
|
||||||
&& [ "${1}" != "5.5" ] \
|
&& [ "${2}" != "5.5" ] \
|
||||||
&& [ "${1}" != "5.6" ] \
|
&& [ "${2}" != "5.6" ] \
|
||||||
&& [ "${1}" != "7.0" ] \
|
&& [ "${2}" != "7.0" ] \
|
||||||
&& [ "${1}" != "7.1" ] \
|
&& [ "${2}" != "7.1" ] \
|
||||||
&& [ "${1}" != "7.2" ] \
|
&& [ "${2}" != "7.2" ] \
|
||||||
&& [ "${1}" != "7.3" ] \
|
&& [ "${2}" != "7.3" ] \
|
||||||
&& [ "${1}" != "7.4" ] \
|
&& [ "${2}" != "7.4" ] \
|
||||||
&& [ "${1}" != "8.0" ] \
|
&& [ "${2}" != "8.0" ] \
|
||||||
&& [ "${1}" != "8.1" ] \
|
&& [ "${2}" != "8.1" ] \
|
||||||
&& [ "${1}" != "8.2" ]; then
|
&& [ "${2}" != "8.2" ]; then
|
||||||
# Argument does not match any of the PHP versions
|
# Argument does not match any of the PHP versions
|
||||||
echo "Error, invalid argument."
|
echo "Error, invalid argument."
|
||||||
print_usage
|
print_usage
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
# Update PHP modules for one specific PHP version
|
# Update PHP modules for one specific PHP version
|
||||||
update_readme "${1}"
|
update_readme "${2}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ IFS=$'\n'
|
|||||||
###
|
###
|
||||||
### Variables
|
### Variables
|
||||||
###
|
###
|
||||||
|
|
||||||
# Current directory
|
# Current directory
|
||||||
CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
|
CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
|
||||||
|
|
||||||
@@ -31,51 +30,56 @@ CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
|
|||||||
###
|
###
|
||||||
### Sanity check
|
### Sanity check
|
||||||
###
|
###
|
||||||
if [ "${#}" -ne "2" ]; then
|
if [ "${#}" -ne "4" ]; then
|
||||||
echo "Usage: start.ci <version> <flavour>"
|
echo "Usage: start.ci <image> <arch> <version> <flavour>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
IMAGE="${1}"
|
||||||
|
ARCH="${2}"
|
||||||
|
VERSION="${3}"
|
||||||
|
FLAVOUR="${4}"
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
### Run tests
|
### Run tests
|
||||||
###
|
###
|
||||||
if [ "${2}" = "base" ] || [ "${2}" = "mods" ] || [ "${2}" = "prod" ] || [ "${2}" = "work" ]; then
|
if [ "${FLAVOUR}" = "base" ] || [ "${FLAVOUR}" = "mods" ] || [ "${FLAVOUR}" = "prod" ] || [ "${FLAVOUR}" = "work" ]; then
|
||||||
TESTS="$( find ${CWD} -regex "${CWD}/base/[0-9].+.*\.sh" | sort -u )"
|
TESTS="$( find ${CWD} -regex "${CWD}/base/[0-9].+.*\.sh" | sort -u )"
|
||||||
for t in ${TESTS}; do
|
for t in ${TESTS}; do
|
||||||
printf "\n\n\033[0;33m%s\033[0m\n" "################################################################################"
|
printf "\n\n\033[0;33m%s\033[0m\n" "################################################################################"
|
||||||
printf "\033[0;33m%s %s\033[0m\n" "#" "[${1}-${2}]: ${t}"
|
printf "\033[0;33m%s %s\033[0m\n" "#" "[${VERSION}-${FLAVOUR}] (${ARCH}): ${t}"
|
||||||
printf "\033[0;33m%s\033[0m\n\n" "################################################################################"
|
printf "\033[0;33m%s\033[0m\n\n" "################################################################################"
|
||||||
time ${t} devilbox/php-fpm ${1} ${2}
|
time ${t} "${IMAGE}" "${VERSION}" "${FLAVOUR}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${2}" = "mods" ] || [ "${2}" = "prod" ] || [ "${2}" = "work" ]; then
|
if [ "${FLAVOUR}" = "mods" ] || [ "${FLAVOUR}" = "prod" ] || [ "${FLAVOUR}" = "work" ]; then
|
||||||
TESTS="$( find ${CWD} -regex "${CWD}/mods/[0-9].+.*\.sh" | sort -u )"
|
TESTS="$( find ${CWD} -regex "${CWD}/mods/[0-9].+.*\.sh" | sort -u )"
|
||||||
for t in ${TESTS}; do
|
for t in ${TESTS}; do
|
||||||
printf "\n\n\033[0;33m%s\033[0m\n" "################################################################################"
|
printf "\n\n\033[0;33m%s\033[0m\n" "################################################################################"
|
||||||
printf "\033[0;33m%s %s\033[0m\n" "#" "[${1}-${2}]: ${t}"
|
printf "\033[0;33m%s %s\033[0m\n" "#" "[${VERSION}-${FLAVOUR}] (${ARCH}): ${t}"
|
||||||
printf "\033[0;33m%s\033[0m\n\n" "################################################################################"
|
printf "\033[0;33m%s\033[0m\n\n" "################################################################################"
|
||||||
time ${t} devilbox/php-fpm ${1} ${2}
|
time ${t} "${IMAGE}" "${VERSION}" "${FLAVOUR}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${2}" = "prod" ] || [ "${2}" = "work" ]; then
|
if [ "${FLAVOUR}" = "prod" ] || [ "${FLAVOUR}" = "work" ]; then
|
||||||
TESTS="$( find ${CWD} -regex "${CWD}/prod/[0-9].+.*\.sh" | sort -u )"
|
TESTS="$( find ${CWD} -regex "${CWD}/prod/[0-9].+.*\.sh" | sort -u )"
|
||||||
for t in ${TESTS}; do
|
for t in ${TESTS}; do
|
||||||
printf "\n\n\033[0;33m%s\033[0m\n" "################################################################################"
|
printf "\n\n\033[0;33m%s\033[0m\n" "################################################################################"
|
||||||
printf "\033[0;33m%s %s\033[0m\n" "#" "[${1}-${2}]: ${t}"
|
printf "\033[0;33m%s %s\033[0m\n" "#" "[${VERSION}-${FLAVOUR}] (${ARCH}): ${t}"
|
||||||
printf "\033[0;33m%s\033[0m\n\n" "################################################################################"
|
printf "\033[0;33m%s\033[0m\n\n" "################################################################################"
|
||||||
time ${t} devilbox/php-fpm ${1} ${2}
|
time ${t} "${IMAGE}" "${VERSION}" "${FLAVOUR}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${2}" = "work" ]; then
|
if [ "${FLAVOUR}" = "work" ]; then
|
||||||
TESTS="$( find ${CWD} -regex "${CWD}/work/[0-9].+.*\.sh" | sort -u )"
|
TESTS="$( find ${CWD} -regex "${CWD}/work/[0-9].+.*\.sh" | sort -u )"
|
||||||
for t in ${TESTS}; do
|
for t in ${TESTS}; do
|
||||||
printf "\n\n\033[0;33m%s\033[0m\n" "################################################################################"
|
printf "\n\n\033[0;33m%s\033[0m\n" "################################################################################"
|
||||||
printf "\033[0;33m%s %s\033[0m\n" "#" "[${1}-${2}]: ${t}"
|
printf "\033[0;33m%s %s\033[0m\n" "#" "[${VERSION}-${FLAVOUR}] (${ARCH}): ${t}"
|
||||||
printf "\033[0;33m%s\033[0m\n\n" "################################################################################"
|
printf "\033[0;33m%s\033[0m\n\n" "################################################################################"
|
||||||
time ${t} devilbox/php-fpm ${1} ${2}
|
time ${t} "${IMAGE}" "${VERSION}" "${FLAVOUR}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user