diff --git a/Dockerfile b/Dockerfile index 11d60190..f6c247c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,23 +28,27 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer WORKDIR /var/www/html -# Copy ALL application files first (needed for custom autoload paths) +# Copy application files COPY --chown=www-data:www-data . . -# Create storage directories +# Remove any nested vendor directories to avoid conflicts +RUN find . -type d -name "vendor" -not -path "./vendor*" -exec rm -rf {} + 2>/dev/null || true + +# Create all necessary directories RUN mkdir -p storage/framework/{cache,sessions,views} \ && mkdir -p storage/logs \ && mkdir -p bootstrap/cache \ && chmod -R 777 storage \ && chmod -R 777 bootstrap/cache -# Install dependencies (now all app files exist for autoloading) -RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader +# Install dependencies +RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader --no-scripts \ + && composer run-script post-autoload-dump \ + && php artisan package:discover --ansi || true -# Generate key (after composer install) -RUN php artisan key:generate --no-interaction --force +# Generate application key +RUN php artisan key:generate --no-interaction --force || true -# Copy entrypoint script COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh