Running cron in the Docker Hub WordPress image
I need to run wp cron.php regularly... so I need cron. Wiring cron into supervisord would be quite a hassle, so I just handled it simply. Dockerfile cron file T
GGAMI
I need to run wp cron.php regularly... so I need cron. Wiring cron into supervisord would be quite a hassle, so I just handled it simply. Dockerfile cron file T
I need to run wp-cron.php regularly... so I need cron.
Wiring cron into supervisord would be quite a hassle, so I just handled it simply.
FROM wordpress:5-php7.4-apache
RUN apt-get update && apt-get -y install cron
ADD ./cron /etc/cron.d/php-cron
RUN chmod 0644 /etc/cron.d/php-cron
RUN sed -i -e 's/\r$//' /etc/cron.d/php-cron
RUN crontab /etc/cron.d/php-cron
# Create the log file to be able to run tail
RUN touch /var/log/cron.log
# Run the command on container startup
CMD cron && apache2-foregroundSHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
*/15 * * * * php -q /var/www/html/wp-cron.phpThis solved it. It's currently working very well! GOOD (I haven't set up a healthcheck...)
wp-cron.php runs automatically every 15 minutes. I'm using it successfully with an image plugin, which compresses newly uploaded images every 15 minutes.