#!/bin/sh echo "Starting Quartz Wiki..." # Check if content directory has files if [ -z "$(ls -A /app/content 2>/dev/null)" ]; then echo "Warning: Content directory is empty!" # Create a default index page mkdir -p /app/content echo "# Wiki Home Willkommen im doing-it Wiki! Dieses Wiki wird mit Obsidian Quartz betrieben. " > /app/content/index.md fi # Copy content to Quartz content directory echo "Copying vault content to Quartz..." mkdir -p /app/quartz-repo/content cp -r /app/content/* /app/quartz-repo/content/ 2>/dev/null || true # Build Quartz echo "Building Quartz site..." cd /app/quartz-repo # Check if Quartz CLI exists and try different methods QUARTZ_CLI="/app/quartz-repo/node_modules/@jackyzha0/quartz/cli/index.js" QUARTZ_BUILD_SUCCESS=false # Method 1: Direct node call to Quartz CLI (avoids npx BusyBox issue) if [ -f "$QUARTZ_CLI" ]; then echo "Trying direct node call to Quartz CLI..." if node "$QUARTZ_CLI" build --contentDir ./content --outputDir /app/public 2>&1; then QUARTZ_BUILD_SUCCESS=true echo "Quartz build successful!" fi fi # Method 2: Try using npm run script if [ "$QUARTZ_BUILD_SUCCESS" = false ] && [ -f "package.json" ]; then echo "Trying npm run build..." if npm run build 2>&1; then QUARTZ_BUILD_SUCCESS=true echo "Quartz build successful via npm!" # Copy output if it went to default location if [ -d "./public" ] && [ -n "$(ls -A ./public 2>/dev/null)" ]; then cp -r ./public/* /app/public/ 2>/dev/null || true fi fi fi # If Quartz build succeeded, copy output if [ "$QUARTZ_BUILD_SUCCESS" = true ]; then if [ -d "/app/quartz-repo/public" ] && [ -n "$(ls -A /app/quartz-repo/public 2>/dev/null)" ]; then echo "Copying Quartz output to public directory..." cp -r /app/quartz-repo/public/* /app/public/ 2>/dev/null || true fi fi # If build failed, create fallback static site if [ "$QUARTZ_BUILD_SUCCESS" = false ]; then echo "Quartz build failed, creating fallback static site..." mkdir -p /app/public cd /app/content # Create index.html cat > /app/public/index.html << 'EOFHTML' doing-it Wiki

doing-it Wiki

Willkommen im doing-it Wiki! Hier finden Sie nützliche Informationen rund um IT-Weiterbildung und Schulungen.

Inhalte

" >> /app/public/index.html echo "
" >> /app/public/index.html echo "" >> /app/public/index.html echo "" >> /app/public/index.html # Copy markdown files to public cp -r /app/content/* /app/public/ 2>/dev/null || true fi # Ensure public directory exists if [ ! -d "/app/public" ] || [ -z "$(ls -A /app/public 2>/dev/null)" ]; then echo "Error: Public directory is empty, creating minimal site..." mkdir -p /app/public echo "doing-it Wiki

doing-it Wiki

Wiki wird geladen...

" > /app/public/index.html fi echo "Build complete. Starting server on port 8080..." cd /app serve -s public -l 8080