diff --git a/Dockerfile b/Dockerfile index 2cd61fc2..eea72d88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,4 +30,8 @@ RUN sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php5/fpm/php-fpm.co EXPOSE 8000 -CMD ["/sbin/entrypoint.sh"] \ No newline at end of file +COPY crontab /etc/cron.d/artisan-schedule +RUN chmod 0644 /etc/cron.d/artisan-schedule +RUN touch /var/log/cron.log + +CMD ["/sbin/entrypoint.sh"] diff --git a/config/app.php b/config/app.php index 1b31c8ad..0d8a8d98 100644 --- a/config/app.php +++ b/config/app.php @@ -61,7 +61,7 @@ return [ | */ - 'locale' => 'en', + 'locale' => env('APP_LOCALE', 'en'), /* |-------------------------------------------------------------------------- @@ -104,7 +104,7 @@ return [ | */ - 'log' => 'daily', + 'log' => env('LOGGING_MODE', 'daily'), /* |-------------------------------------------------------------------------- diff --git a/docker/.env.docker b/docker/.env.docker index 90c05e30..b28f9a0f 100644 --- a/docker/.env.docker +++ b/docker/.env.docker @@ -24,3 +24,6 @@ MAIL_NAME={{MAIL_NAME}} REDIS_HOST={{REDIS_HOST}} REDIS_DATABASE={{REDIS_DATABASE}} REDIS_PORT={{REDIS_PORT}} + +LOGGING_MODE={{LOGGING_MODE}} +APP_LOCALE={{APP_LOCALE}} diff --git a/docker/crontab b/docker/crontab new file mode 100644 index 00000000..1b0fa150 --- /dev/null +++ b/docker/crontab @@ -0,0 +1,2 @@ +#minute hour mday month wday who command +* * * * * www-data php /var/www/html/artisan schedule:run 1>> /dev/null 2>&1 diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 0a73b813..5f0de106 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -28,6 +28,9 @@ REDIS_HOST=${REDIS_HOST:-null} REDIS_DATABASE=${REDIS_DATABASE:-null} REDIS_PORT=${REDIS_PORT:-null} +LOGGING_MODE=${LOGGING_MODE:-daily} +APP_LOCALE=${APP_LOCALE:-en} + # configure env file sed 's,{{APP_ENV}},'"${APP_ENV}"',g' -i /var/www/html/.env @@ -57,6 +60,9 @@ sed 's,{{REDIS_HOST}},'"${REDIS_HOST}"',g' -i /var/www/html/.env sed 's,{{REDIS_DATABASE}},'"${REDIS_DATABASE}"',g' -i /var/www/html/.env sed 's,{{REDIS_PORT}},'"${REDIS_PORT}"',g' -i /var/www/html/.env +sed 's,{{LOGGING_MODE}},'"${LOGGING_MODE}"',g' -i /var/www/html/.env +sed 's,{{APP_LOCALE}},'"${APP_LOCALE}"',g' -i /var/www/html/.env + #Clear cache /usr/bin/php composer.phar install --no-dev -o diff --git a/docker/supervisord.conf b/docker/supervisord.conf index d0cef069..c3e6f453 100644 --- a/docker/supervisord.conf +++ b/docker/supervisord.conf @@ -23,3 +23,6 @@ command=/usr/sbin/php5-fpm -c /etc/php5/fpm [program:nginx] command=/usr/sbin/nginx + +[program:cron] +command=/usr/sbin/cron -f