fix dockerfile
This commit is contained in:
29
Dockerfile
29
Dockerfile
@@ -28,27 +28,28 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
|||||||
|
|
||||||
WORKDIR /var/www/html
|
WORKDIR /var/www/html
|
||||||
|
|
||||||
# Copy all application files
|
# Copy composer files first (for dependency caching)
|
||||||
|
COPY composer.json composer.lock* ./
|
||||||
|
|
||||||
|
# Install dependencies BEFORE copying application files
|
||||||
|
RUN composer install --no-interaction --no-progress --optimize-autoloader
|
||||||
|
|
||||||
|
# Copy the rest of the application files
|
||||||
COPY --chown=www-data:www-data . .
|
COPY --chown=www-data:www-data . .
|
||||||
|
|
||||||
# CRITICAL: Create storage directories BEFORE composer install
|
# Create necessary directories
|
||||||
RUN mkdir -p storage/framework/{cache,sessions,views} \
|
RUN mkdir -p storage/framework/{cache,sessions,views} \
|
||||||
&& mkdir -p storage/logs \
|
&& mkdir -p storage/logs \
|
||||||
&& mkdir -p bootstrap/cache \
|
&& mkdir -p bootstrap/cache \
|
||||||
&& chmod -R 777 storage \
|
&& chmod -R 775 storage \
|
||||||
&& chmod -R 777 bootstrap/cache
|
&& chmod -R 775 bootstrap/cache \
|
||||||
|
&& chown -R www-data:www-data storage bootstrap
|
||||||
|
|
||||||
# Verify directories exist (debug)
|
# Generate application key
|
||||||
RUN ls -la storage/framework/ && ls -la bootstrap/
|
RUN php artisan key:generate --no-interaction --force
|
||||||
|
|
||||||
# Install dependencies with --no-scripts first to avoid post-install commands
|
# Clear and cache configurations (optional)
|
||||||
RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader --no-scripts
|
RUN php artisan config:clear && php artisan cache:clear || true
|
||||||
|
|
||||||
# Now run the post-install scripts (storage exists now)
|
|
||||||
RUN composer run-script post-autoload-dump || echo "Post-autoload dump skipped"
|
|
||||||
|
|
||||||
# Generate key if needed
|
|
||||||
RUN php artisan key:generate --no-interaction --force || true
|
|
||||||
|
|
||||||
# Copy entrypoint script
|
# Copy entrypoint script
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
|||||||
Reference in New Issue
Block a user