diff --git a/build.sh b/build.sh index e0f981c..39900ca 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Build all sites: generate nginx.conf, render templates, prepare build/ directory +# Build all sites: generate Caddyfile, render templates, prepare build/ directory set -euo pipefail SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) @@ -11,10 +11,10 @@ echo "=== Onepager Build ===" rm -rf "$BUILD_DIR" mkdir -p "$BUILD_DIR" -# 1. Generate nginx.conf -echo "[1/3] Generating nginx.conf..." -"$SCRIPT_DIR/nginx/generate-nginx.sh" "$SCRIPT_DIR/sites" > "$SCRIPT_DIR/nginx/nginx.conf" -echo " -> nginx/nginx.conf written" +# 1. Generate Caddyfile +echo "[1/3] Generating Caddyfile..." +"$SCRIPT_DIR/generate-caddyfile.sh" "$SCRIPT_DIR/sites" > "$SCRIPT_DIR/Caddyfile" +echo " -> Caddyfile written" # 2. Build each site echo "[2/3] Building sites..." @@ -45,15 +45,6 @@ for site_dir in "$SCRIPT_DIR/sites"/*/; do done echo " -> $count sites built" -# 3. Validate nginx config (if docker is available) -echo "[3/3] Validating nginx config..." -if command -v docker &>/dev/null; then - docker run --rm \ - -v "$SCRIPT_DIR/nginx/nginx.conf:/etc/nginx/nginx.conf:ro" \ - -v "$BUILD_DIR:/usr/share/nginx/html:ro" \ - nginx:alpine nginx -t 2>&1 && echo " -> nginx config valid" || echo " [WARN] nginx validation failed (non-fatal for local builds)" -else - echo " [SKIP] Docker not available, skipping nginx validation" -fi - +# 3. Report +echo "[3/3] Build complete" echo "=== Build complete: $count sites ==="