Added nginx to server static content when app is in container

This commit is contained in:
Deon George
2020-03-11 14:43:15 +11:00
parent e87698b30c
commit c8cc79dbb3
3 changed files with 53 additions and 2 deletions

14
init
View File

@@ -5,6 +5,8 @@ role=${CONTAINER_ROLE:-app}
env=${APP_ENV:-live}
php=${PHP_DIR:-/var/www/html}
composer=${COMPOSER_DIR:-/var/www/.composer}
NO_NGINX=${NO_NGINX:-TRUE}
SSH_START=${SSH_START:-FALSE}
function mp() {
set +e
@@ -14,6 +16,14 @@ function mp() {
echo ${mp}
}
function nginx_start() {
# Start NGINX
if [ -x /usr/sbin/nginx -a "${NO_NGINX}" != "TRUE" ]; then
echo "* Starting NGINX..."
start-stop-daemon --start --pidfile /var/run/nginx.pid --exec /usr/sbin/nginx -- -g 'daemon on; master_process on;'
fi
}
# General Setup
if [ -x /usr/sbin/sshd -a "${SSH_START}" = "TRUE" ]; then
[ ! -d /var/run/sshd ] && mkdir /var/run/sshd
@@ -79,6 +89,8 @@ if [ "${role}" = "app" -a -e artisan ]; then
fi
fi
nginx_start
exec /usr/local/bin/docker-php-entrypoint "$@"
elif [ "$role" = "queue" -a -e artisan ]; then
@@ -129,6 +141,8 @@ elif [ "$role" = "scheduler" -a -e artisan ]; then
"
else
nginx_start
echo "? NO container role \"${role}\", AND/OR no laravel install, just starting php-fpm"
exec /usr/local/bin/docker-php-entrypoint "$@"
fi