Update docker/start.sh
Some checks failed
Publish Docker Image / docker (push) Has been cancelled

This commit is contained in:
Lee 2024-09-28 11:09:40 +00:00
parent 0ad26585e4
commit 7714cc614a

@ -45,15 +45,24 @@ sed -i "s/^post_max_size = .*/post_max_size = ${MAX_UPLOAD_SIZE}/" /etc/php83/ph
# Set max upload size for nginx # Set max upload size for nginx
sed -i "s/client_max_body_size 500M;/client_max_body_size ${MAX_UPLOAD_SIZE};/" /etc/nginx/nginx.conf sed -i "s/client_max_body_size 500M;/client_max_body_size ${MAX_UPLOAD_SIZE};/" /etc/nginx/nginx.conf
function start() { # Function to handle signal forwarding and service startup
echo "Starting PHP & Nginx" function start_services() {
php-fpm83 && echo "Starting PHP-FPM and Nginx..."
chmod 777 /run/php/php.sock && php-fpm83 --nodaemonize &
/usr/local/sbin/nginx -g 'daemon off;' PHP_FPM_PID=$!
nginx -g 'daemon off;' &
NGINX_PID=$!
# Wait for both processes to finish
wait $PHP_FPM_PID $NGINX_PID
} }
# Start Nginx and retry if it fails # Trap SIGTERM and SIGINT and forward to PHP-FPM and Nginx
until start; do trap "echo 'Stopping services...'; kill -TERM $PHP_FPM_PID $NGINX_PID" SIGTERM SIGINT
echo "Nginx failed to start, retrying in 5 seconds..."
# Start the services and retry if Nginx fails
until start_services; do
echo "Nginx or PHP-FPM failed to start, retrying in 5 seconds..."
sleep 5 sleep 5
done done