diff --git a/Dockerfile b/Dockerfile index f6c247c3..b90a2b03 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,8 @@ RUN apk add --no-cache \ oniguruma-dev \ git \ curl \ + nodejs \ + npm \ && docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-install -j$(nproc) \ pdo_pgsql \ @@ -28,6 +30,13 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer WORKDIR /var/www/html +# Copy package files first for better caching +COPY package*.json ./ +COPY vite.config.js ./ + +# Install NPM dependencies +RUN npm ci --no-audit --no-fund + # Copy application files COPY --chown=www-data:www-data . . @@ -41,7 +50,10 @@ RUN mkdir -p storage/framework/{cache,sessions,views} \ && chmod -R 777 storage \ && chmod -R 777 bootstrap/cache -# Install dependencies +# Build Vite assets (this generates manifest.json) +RUN npm run build + +# Install PHP 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 diff --git a/entrypoint.sh b/entrypoint.sh index 0889145f..767f52e2 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -67,6 +67,15 @@ php artisan cache:clear || true php artisan view:clear || true php artisan route:clear || true +# Verify Vite manifest exists +if [ -f public/build/manifest.json ]; then + echo "✅ Vite manifest found at public/build/manifest.json" +else + echo "⚠️ Warning: Vite manifest not found! Assets may not load correctly." + echo "Current contents of public/build:" + ls -la public/build/ 2>/dev/null || echo "public/build directory does not exist" +fi + # Optional: Run migrations if needed # php artisan migrate --force