If you are building this as your own hobby project then yes, why not.
But if this is for a client, do them and future support people a favour and stick to standard methods of hosting so that it can actually be supported going forwards.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am containirizing a laravel application. What I am making is a container that will run laravel cron scheduler:
FROM php:8.1-alpine
# Load nessesary php module here
COPY . /var/www/html
RUN echo "Installing composer \n" &&\
php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" &&\
php /tmp/composer-setup.php --install-dir=/bin --filename=composer &&\
rm -rf /tmp/cpmposer-setup.php &&\
chmod +x /bin/composer &&\
cd /var/www/html &&\
composer install &&\
rm -rf composer
COPY ./entrypoint/entrypoint_cron.sh /usr/local/bin/entrypoint.sh
RUN echo "Fixing Permissions on Entrypoint Script \n" &&\
chown root:root /usr/local/bin/entrypoint.sh &&\
chmod +x /usr/local/bin/entrypoint.sh &&\
usermod --shell /bin/bash www-data
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["php","artisan","schedule:run"]
The build image will have the following entrypoint:
#!/bin/sh
while true
do
"$@"
sleep 60
done
But what complications my approach may have instead of using crontab?
Please or to participate in this conversation.