Skip to content

Instantly share code, notes, and snippets.

@Spittal
Created October 17, 2019 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Spittal/7452ad7ecd91c6d590b0b75005daf1a0 to your computer and use it in GitHub Desktop.
Save Spittal/7452ad7ecd91c6d590b0b75005daf1a0 to your computer and use it in GitHub Desktop.
// Dockerfile
FROM sbvr/laravel-alpine
# Cron Scheudler conf https://laravel.com/docs/5.4/scheduling#introduction
COPY schedule-cron /var/spool/cron/crontabs/root
RUN chmod +x /var/spool/cron/crontabs/root
COPY cron.ini /etc/supervisor.d/
CMD [ "supervisord", "-n" ]
// schedule-cron (crontab)
#!/bin/sh
* * * * * php /var/www/html/artisan schedule:run >> /dev/stdout 2>&1
// cron.ini (supervisor conf for cron)
[program:cron]
process_name=%(program_name)s
command=crond -f
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:forward_logs]
process_name=%(program_name)s
command=ln -sf /proc/1/fd/1 /var/www/html/storage/logs/cron.log
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
startsecs=0
priority=999
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment