Enhance Dockerfile for Laravel application with NTP support

- Added NTP package installation to synchronize time within the container.
- Configured a cron job for automatic time updates, improving time accuracy for scheduled tasks.
- Updated file permission settings and added echo statements for better logging and clarity during setup.

These changes enhance the Docker environment by ensuring accurate timekeeping, which is crucial for scheduled tasks in the Laravel application.
This commit is contained in:
Ümit Tunç
2025-01-20 22:43:45 +03:00
parent 7d108ca032
commit c7b06c0cba
+4 -1
View File
@@ -18,6 +18,7 @@ RUN apt-get update && apt-get install -y \
libxml2-dev \
zip \
cron \
ntp \
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd \
&& echo "* * * * * cd /var/www && php artisan schedule:run >> /dev/null 2>&1" >> /etc/cron.d/laravel-cron \
&& chmod 0644 /etc/cron.d/laravel-cron \
@@ -49,7 +50,9 @@ RUN set -x && \
chmod -R 775 /var/www/storage/framework/views && \
echo "Views izinleri ayarlandı" && \
chmod -R 775 /var/www/public && \
echo "Public dizin izinleri ayarlandı"
echo "Public dizin izinleri ayarlandı" && \
echo "0 0 * * * root /usr/sbin/ntpdate -u pool.ntp.org" >> /etc/crontab && \
echo "Otomatik saat güncelleme ayarlandı"
# Laravel uygulamasını başlatma ve loglama
RUN set -x && \