Open hotrush opened 4 years ago
@hotrush I had the same problem had to alter the code a bit.
# Add crontab file in the cron directory
ADD ./.deploy/config/schedule/crontab /etc/cron.d/cron
# Give execution rights on the cron job
RUN chmod 0644 /etc/cron.d/cron
# Create the log file to be able to run tail
RUN touch /var/log/cron.log
# Run the command on container startup
CMD printenv > /etc/environment && echo "cron starting..." && (cron) && : > /var/log/cron.log && tail -f /var/log/cron.log
@dragonfire1119 mind sharing where do you place these lines?
@darrist Placed it right under
# RUN (crontab -l ; echo "* * * * * /usr/local/bin/php /srv/app/artisan schedule:run >> /dev/null 2>&1") | crontab
I have this:
RUN apt-get update && apt-get install -y build-essential cron curl locales zip unzip git
# Setup cron job
# RUN (crontab -l ; echo "* * * * * /usr/local/bin/php /srv/app/artisan schedule:run >> /dev/null 2>&1") | crontab
# Add crontab file in the cron directory
ADD ./.deploy/config/schedule/crontab /etc/cron.d/cron
# Give execution rights on the cron job
RUN chmod 0644 /etc/cron.d/cron
# Create the log file to be able to run tail
RUN touch /var/log/cron.log
# Run the command on container startup
CMD printenv > /etc/environment && echo "cron starting..." && (cron) && : > /var/log/cron.log && tail -f /var/log/cron.log
# Install supervisord
COPY --from=ochinchina/supervisord:latest /usr/local/bin/supervisord /usr/local/bin/supervisord
.deploy/config/scheduler/crontab:
* * * * * /usr/local/bin/php /srv/app/artisan schedule:run >> /dev/null 2>&1
Will report back if its working. Thanks!
Cron doesn't seem to be running.
Haven't tested it yet, but i tried another approach from here https://github.com/thelebster/docker-cron/blob/master/ubuntu/Dockerfile And it doesn't work too... So painful to make it works
Would recommend trying out all the latest changes on the master branch following the move to the alpine image & running all services as a non-root user in https://github.com/jackbrycesmith/laravel-caprover-template/pull/5.
I can see this during image build