* Merging all my junk together. * Add more junk from other repos. * Fix missing hadolint. * Fixed names * Somehow, I missed out a lot of components * More jiggery pokery * More jiggery pokery * Ignore some hadolint warnings * Maybe fix build? * Split back up php Dockerfile. * dockerfile->file * Flavours environment issues * Fix flavours? * remove onbuilds. * Might be these quotes tripping it up. * Try without caching/buildx/qemu * OK it needs caching/buildx/qemu lol * remove build cache. * Put build caching back * Add octoprint bits * Add pulls. * Fix build order + linter. * rejig multistage builder to make hadolint happy(ier)
34 lines
1.5 KiB
Bash
Executable file
34 lines
1.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
env | sed "s/\(.*\)=\(.*\)/env[\1]='\2'/" > /etc/php/{{PHP}}/fpm/conf.d/env.conf
|
|
|
|
if [ "${DEBUG_MODE,,}" = "on" ]; then
|
|
ENABLE_DEBUG_MODE=true
|
|
PHP_MEMORY_LIMIT="${PHP_MEMORY_LIMIT:-1024M}"
|
|
else
|
|
ENABLE_DEBUG_MODE=false
|
|
PHP_MEMORY_LIMIT="${PHP_MEMORY_LIMIT:-128M}"
|
|
fi
|
|
|
|
sed -i "s|memory_limit = .*|memory_limit = ${PHP_MEMORY_LIMIT}|g" /etc/php/{{PHP}}/fpm/php.ini
|
|
sed -i "s|\[memory_limit\] = .*|\[memory_limit\] = ${PHP_MEMORY_LIMIT}|g" /etc/php/{{PHP}}/fpm/pool.d/www.conf
|
|
|
|
if [ $ENABLE_DEBUG_MODE = true ]; then
|
|
echo -e "#Controlled via DEBUG_MODE environment variable\nzend_extension=xdebug.so\n[xdebug]\n\
|
|
xdebug.mode=debug\n\
|
|
xdebug.start_with_request=yes\n\
|
|
xdebug.client_host=172.17.0.1\n" > /etc/php/{{PHP}}/mods-available/xdebug.ini
|
|
ln -s /etc/php/{{PHP}}/mods-available/xdebug.ini /etc/php/{{PHP}}/fpm/conf.d/20-xdebug.ini || true
|
|
sed -i "s|php_flag\[display_errors\].*|php_flag\[display_errors\] = on|g" /etc/php/{{PHP}}/fpm/pool.d/www.conf
|
|
echo -e "RUNNING IN \e[31mDEBUG MODE\e[0m\nError output will be VISIBLE."
|
|
else
|
|
rm /etc/php/{{PHP}}/mods-available/xdebug.ini
|
|
touch /etc/php/{{PHP}}/mods-available/xdebug.ini
|
|
rm /etc/php/{{PHP}}/fpm/conf.d/*-xdebug.ini
|
|
sed -i "s|php_flag\[display_errors\].*|php_flag\[display_errors\] = off|g" /etc/php/{{PHP}}/fpm/pool.d/www.conf
|
|
echo -e "RUNNING IN \e[32mPRODUCTION MODE\e[0m\nError output will be suppressed."
|
|
fi
|
|
echo "To change this, change the value of DEBUG_MODE"
|
|
|
|
/usr/sbin/php-fpm{{PHP}} -F -R
|
|
|