Hey guys, I played around a bit with the PHP-CLI docker image and posting the Dockerfile result. Flarum directory is mapped as /data/web
. Scheduler runs every minute.
scheduler
FROM php:8.1-cli
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions && \
install-php-extensions curl dom fileinfo gd json mbstring openssl pdo_mysql tokenizer zip
RUN echo '#!/bin/bash' > /scheduler.sh && \
echo 'while true; do' >> /scheduler.sh && \
echo ' cd /data/web && php flarum schedule:run' >> /scheduler.sh && \
echo ' sleep 60' >> /scheduler.sh && \
echo 'done' >> /scheduler.sh && \
chmod +x /scheduler.sh
CMD ["/scheduler.sh"]
worker
FROM php:8.1-cli
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions && \
install-php-extensions curl dom fileinfo gd json mbstring openssl pdo_mysql tokenizer zip
WORKDIR /data/web
CMD ["php", "flarum", "queue:work", "--sleep=3", "--tries=5"]