diff --git a/init b/init index b3fb10a..354f307 100755 --- a/init +++ b/init @@ -4,6 +4,7 @@ set -e role=${CONTAINER_ROLE:-app} env=${APP_ENV:-live} php=${PHP_DIR:-/var/www/html} +composer=${COMPOSER_DIR:-/var/www/.composer} # General Setup if [ -x /usr/sbin/sshd -a "${SSH_START}" = "TRUE" ]; then @@ -13,7 +14,7 @@ fi # Laravel Specific if [ "${role}" = "app" -a -e artisan ]; then - if [ ! -e ${php}.env ]; then + if [ ! -e ${php}/.env ]; then echo "! ERROR: NO .env file..." exec /bin/bash fi @@ -28,6 +29,7 @@ if [ "${role}" = "app" -a -e artisan ]; then # See if we need to refresh our dependancies if [[ -r composer.lock && ( -e .composer.refresh || ! -d vendor ) ]]; then rm -f ${php}/bootstrap/cache/*.php + chown -R www-data:www-data ${composer} su www-data -s /bin/sh -c "composer install" && ( test -e .composer.refresh && rm -f .composer.refresh ) fi @@ -43,7 +45,7 @@ if [ "${role}" = "app" -a -e artisan ]; then exec /usr/local/bin/docker-php-entrypoint "$@" elif [ "$role" = "queue" -a -e artisan ]; then - if [ ! -e ${php}.env ]; then + if [ ! -e ${php}/.env ]; then echo "! ERROR: NO .env file..." exec /bin/bash fi @@ -56,7 +58,7 @@ elif [ "$role" = "queue" -a -e artisan ]; then done elif [ "$role" = "scheduler" -a -e artisan ]; then - if [ ! -e ${php}.env ]; then + if [ ! -e ${php}/.env ]; then echo "! ERROR: NO .env file..." exec /bin/bash fi