# Use the existing base image defined in Laravel Sail
FROM sail-8.3/app

# Install cron
RUN apt-get update && apt-get install -y cron

# Add a custom cron job file
COPY ./cronjobs /etc/cron.d/laravel-queue

# Give execution rights on the cron job
RUN chmod 0644 /etc/cron.d/laravel-queue

# Apply cron job
RUN crontab /etc/cron.d/laravel-queue

# Start cron and the Laravel queue worker
CMD cron && php /var/www/html/artisan queue:work
