- Enhanced Dockerfile for Laravel application by updating file permissions and improving cron job configuration.
- Added NTP service initialization to ensure accurate time synchronization within the container. - Modified cron job command to run all fetch tasks, improving scheduled task management. - Included additional echo statements for better logging during the setup process. These changes improve the Docker environment's reliability and enhance the functionality of scheduled tasks in the Laravel application.
This commit is contained in:
Regular → Executable
+11
-4
@@ -16,11 +16,13 @@ RUN apt-get update && apt-get install -y \
|
||||
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 \
|
||||
&& service cron start && \
|
||||
ntpd -gq && \
|
||||
ntpd && \
|
||||
docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd \
|
||||
&& echo "* * * * * cd /var/www && php /var/www/artisan run-all-fetchs >> /dev/null 2>&1" >> /etc/cron.d/laravel-cron \
|
||||
&& chmod 0644 /etc/cron.d/laravel-cron \
|
||||
&& crontab /etc/cron.d/laravel-cron \
|
||||
&& service cron start
|
||||
&& crontab /etc/cron.d/laravel-cron
|
||||
|
||||
# Composer'ı yükleyelim
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
@@ -28,6 +30,7 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
# Laravel proje dosyalarını kopyalayalım
|
||||
COPY . .
|
||||
|
||||
|
||||
# Gerekli dizinleri oluşturma
|
||||
RUN mkdir -p /var/www/storage/app/private/scribe
|
||||
|
||||
@@ -67,3 +70,7 @@ RUN set -x && \
|
||||
php artisan scribe:generate && \
|
||||
echo "API dokümantasyonu oluşturuldu" && \
|
||||
echo "Laravel uygulaması başarıyla başlatıldı.";
|
||||
|
||||
|
||||
RUN service cron start && \
|
||||
echo "Cron başlatıldı"
|
||||
|
||||
Reference in New Issue
Block a user