mirror of
https://github.com/devilbox/docker-php-fpm.git
synced 2026-01-10 09:54:43 +00:00
Add option to customize PHP-FPM configuration
This commit is contained in:
48
Dockerfiles/prod/data/docker-entrypoint.d/36-custom-php-fpm-files.sh
Executable file
48
Dockerfiles/prod/data/docker-entrypoint.d/36-custom-php-fpm-files.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
|
||||
############################################################
|
||||
# Functions
|
||||
############################################################
|
||||
|
||||
###
|
||||
### Copy PHP-FPM *.conf files from source to destination with prefix
|
||||
###
|
||||
copy_fpm_files() {
|
||||
local fpm_src="${1}"
|
||||
local fpm_dst="${2}"
|
||||
local debug="${3}"
|
||||
|
||||
if [ ! -d "${fpm_src}" ]; then
|
||||
run "mkdir -p ${fpm_src}" "${debug}"
|
||||
fi
|
||||
fpm_files="$( find "${fpm_src}" -type f -iname '*.conf' )"
|
||||
|
||||
# loop over them line by line
|
||||
IFS='
|
||||
'
|
||||
for fpm_f in ${fpm_files}; do
|
||||
fpm_name="$( basename "${fpm_f}" )"
|
||||
log "info" "PHP-FOM.conf: ${fpm_name} -> ${fpm_dst}/zzz-devilbox-${fpm_name}" "${debug}"
|
||||
run "cp ${fpm_f} ${fpm_dst}/zzz-devilbox-${fpm_name}" "${debug}"
|
||||
done
|
||||
run "find ${fpm_dst} -type f -iname '*.conf' -exec chmod 0644 \"{}\" \;" "${debug}"
|
||||
}
|
||||
|
||||
|
||||
############################################################
|
||||
# Sanity Checks
|
||||
############################################################
|
||||
|
||||
if ! command -v find >/dev/null 2>&1; then
|
||||
echo "find not found, but required."
|
||||
exit 1
|
||||
fi
|
||||
if ! command -v basename >/dev/null 2>&1; then
|
||||
echo "basename not found, but required."
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user