Docker base images for PHP-FPM

This commit is contained in:
ChiefSoft works
2022-07-31 14:54:16 +00:00
parent 7865c34b7d
commit 5959d57ac3
144 changed files with 19767 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
if [ ! "$PHP_CRONTABS_PATH" == "" ]; then
printf "env CRONTABS_PATH: setting up crontabs: ";
for f in ${PHP_CRONTABS_PATH}; do
printf "$f, ";
rm -f /etc/cron.d/${f##*/}
cp $f /etc/cron.d/
chmod 0644 /etc/cron.d/${f##*/}
done
echo
touch /var/log/cron.log
printenv | grep -v "no_proxy" >> /etc/environment
/etc/init.d/cron start > /dev/null
fi
+56
View File
@@ -0,0 +1,56 @@
#!/bin/bash
/usr/local/bin/php -v
### create system user for php pool
if [ ! "$PHP_USER" == "" ] && [ ! "$PHP_UID" == "" ] && [ ! "$PHP_GID" == "" ] && [ ! "$PHP_HOME" == "" ]; then
echo "env PHP_USER: creating new system user: ${PHP_USER} ${PHP_UID}:${PHP_GID} ${PHP_HOME}"
groupadd -f $PHP_USER -g $PHP_GID && \
useradd -d $PHP_HOME -u $PHP_UID -g $PHP_GID -s /bin/false $PHP_USER
fi
### load PHP ini configurations
if [ ! "$PHP_INI_PATH" == "" ]; then
printf "env PHP_INI_PATH: "
for f in ${PHP_INI_PATH}; do
printf "$f, ";
rm -f /usr/local/etc/php/conf.d/${f##*/}
cp $f /usr/local/etc/php/conf.d/
done
echo
fi
### make sure to create clean php-fpm.conf
### to avoid adding multiple times the same lines next
### in case container is restarting
echo "[global]" > /usr/local/etc/php-fpm.conf
echo "include=etc/php-fpm.d/*.conf" >> /usr/local/etc/php-fpm.conf
### load PHP-FPM pool configurations
if [ ! "$PHP_POOL_PATH" == "" ]; then
printf "env PHP_POOL_PATH: "
for f in ${PHP_POOL_PATH}; do
printf "$f, ";
rm -f /usr/local/etc/php-fpm.d/${f##*/}
cp $f /usr/local/etc/php-fpm.d/
done
echo
echo "include=$PHP_POOL_PATH" >> /usr/local/etc/php-fpm.conf
fi
### load boot bash scripts
for f in /usr/local/bin/*.sh; do
/bin/bash -c $f
done
### load bash scripts
if [ ! "$PHP_BOOT_SCRIPTS" == "" ]; then
printf "env PHP_BOOT_SCRIPTS: "
for f in $PHP_BOOT_SCRIPTS; do
printf "${f##*/}, ";
done
echo
for f in $PHP_BOOT_SCRIPTS; do
/bin/bash -c $f
done
fi
+11
View File
@@ -0,0 +1,11 @@
#!/bin/sh
set -e
/usr/local/bin/docker-boot
# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- php-fpm "$@"
fi
exec "$@"
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
if [ ! "$NEWRELIC_LICENSE" == "" ] ; then
echo "env NEWRELIC_LICENSE: setting up newrelic license"
sed -i "s/REPLACE_WITH_REAL_KEY/$NEWRELIC_LICENSE/g" /usr/local/etc/php/conf.d/newrelic.ini
nrsysmond-config --set license_key=$NEWRELIC_LICENSE
service newrelic-sysmond start > /dev/null
fi
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
if [ -z ${SMTP_LOGIN+x} ] && [ -z ${SMTP_PASSWORD+x} ] && [ ! "$SMTP_LOGIN" == "" ] && [ ! "$SMTP_PASSWORD" == "" ]; then
echo "env SMTP_LOGIN: sendgrid credentials for email routing";
echo "[smtp.sendgrid.net]:2525 ${SMTP_LOGIN}:${SMTP_PASSWORD}" >> /etc/postfix/sasl_passwd
postmap /etc/postfix/sasl_passwd
chmod 600 /etc/postfix/sasl_passwd.db
rm /etc/postfix/sasl_passwd
### update email relay configuration for SendGrid
sed -i 's/default_transport = error//g' /etc/postfix/main.cf && \
sed -i 's/relay_transport = error//g' /etc/postfix/main.cf && \
sed -i 's/relayhost = //g' /etc/postfix/main.cf && \
echo "relayhost = [smtp.sendgrid.net]:2525" >> /etc/postfix/main.cf && \
echo "smtp_tls_security_level = encrypt" >> /etc/postfix/main.cf && \
echo "smtp_sasl_auth_enable = yes" >> /etc/postfix/main.cf && \
echo "smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd" >> /etc/postfix/main.cf && \
echo "header_size_limit = 4096000" >> /etc/postfix/main.cf && \
echo "smtp_sasl_security_options = noanonymous" >> /etc/postfix/main.cf
/etc/init.d/postfix start > /dev/null
fi
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
### update PHP session handler
if [ ! "$PHP_SESSION_HANDLER" == "" ] && [ ! "$PHP_SESSION_PATH" == "" ]; then
echo "env PHP_SESSION_HANDLER: updating php session handler [ $PHP_SESSION_PATH ]"
echo "session.save_handler = $PHP_SESSION_HANDLER" > /usr/local/etc/php/conf.d/zz-session.ini
echo "session.save_path = \"$PHP_SESSION_PATH\"" >> /usr/local/etc/php/conf.d/zz-session.ini
fi