This container is intended to run Laravel application's queues, cron, etc. and thus comes with a few items to assist:
- Composer (with hirak/prestissimo for parallel dependency installation)
- PHP Extensions
spatie/laravel-backup Dependencies
- PHP extension zip
mysql-client
formysqldump
support
For a container to run nginx/fpm for Laravel applications, check out bkuhl/fpm-nginx.
Overwrite the container's default command to perform various Laravel tasks.
- Cron container: use command
crond -f -d 8
- Queue worker container: use command
php /var/www/html/artisan queue:work --sleep=3 --tries=3 --timeout=0
- Migrations container: use command
php /var/www/html/artisan migrate --force
FROM bkuhl/php:7.4
WORKDIR /var/www/html
# Copy the application files to the container
ADD --chown=www-data:www-data . /var/www/html
USER www-data
# production-ready dependencies
RUN composer install --no-interaction --optimize-autoloader --no-dev --prefer-dist \
# keep the container light weight
&& rm -rf /home/www-data/.composer/cache