diff --git a/Dockerfile b/Dockerfile index 486dcbde..483ccf5e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,21 +30,33 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer WORKDIR /var/www/html -# Copy ALL application files first (including artisan) +# Copy ALL application files first COPY --chown=www-data:www-data . . -# Remove any nested vendor directories to avoid conflicts +# Remove any nested vendor directories RUN find . -type d -name "vendor" -not -path "./vendor*" -exec rm -rf {} + 2>/dev/null || true -# Create necessary directories -RUN mkdir -p storage/framework/{cache,sessions,views} \ +# Create all necessary directories with proper structure +RUN mkdir -p storage/framework/cache \ + && mkdir -p storage/framework/sessions \ + && mkdir -p storage/framework/views \ + && mkdir -p storage/framework/testing \ && mkdir -p storage/logs \ && mkdir -p bootstrap/cache \ + && mkdir -p storage/framework/cache/data \ && chmod -R 777 storage \ && chmod -R 777 bootstrap/cache -# Install PHP dependencies (artisan file now exists) -RUN composer install --no-interaction --no-progress --optimize-autoloader +# Create a temporary config to avoid cache path errors +RUN if [ ! -f config/app.php ]; then \ + echo " []];" > config/app.php; \ + fi + +# Install PHP dependencies with --no-scripts to avoid cache path issues +RUN composer install --no-interaction --no-progress --optimize-autoloader --no-scripts + +# Now run the scripts manually with proper environment +RUN composer run-script post-autoload-dump || true # Copy package files for NPM COPY package*.json ./ @@ -54,14 +66,15 @@ COPY vite.config.js ./ RUN npm install --legacy-peer-deps --no-audit # Build Vite assets -RUN npm run build - -# Run package discovery -RUN php artisan package:discover --ansi || true +RUN npm run build || true # Generate application key RUN php artisan key:generate --no-interaction --force || true +# Clear and cache config (but handle missing paths gracefully) +RUN php artisan config:clear || true \ + && php artisan cache:clear || true + COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh