build: use Caddyfile generation instead of nginx
This commit is contained in:
23
build.sh
23
build.sh
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/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
|
set -euo pipefail
|
||||||
|
|
||||||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||||
@@ -11,10 +11,10 @@ echo "=== Onepager Build ==="
|
|||||||
rm -rf "$BUILD_DIR"
|
rm -rf "$BUILD_DIR"
|
||||||
mkdir -p "$BUILD_DIR"
|
mkdir -p "$BUILD_DIR"
|
||||||
|
|
||||||
# 1. Generate nginx.conf
|
# 1. Generate Caddyfile
|
||||||
echo "[1/3] Generating nginx.conf..."
|
echo "[1/3] Generating Caddyfile..."
|
||||||
"$SCRIPT_DIR/nginx/generate-nginx.sh" "$SCRIPT_DIR/sites" > "$SCRIPT_DIR/nginx/nginx.conf"
|
"$SCRIPT_DIR/generate-caddyfile.sh" "$SCRIPT_DIR/sites" > "$SCRIPT_DIR/Caddyfile"
|
||||||
echo " -> nginx/nginx.conf written"
|
echo " -> Caddyfile written"
|
||||||
|
|
||||||
# 2. Build each site
|
# 2. Build each site
|
||||||
echo "[2/3] Building sites..."
|
echo "[2/3] Building sites..."
|
||||||
@@ -45,15 +45,6 @@ for site_dir in "$SCRIPT_DIR/sites"/*/; do
|
|||||||
done
|
done
|
||||||
echo " -> $count sites built"
|
echo " -> $count sites built"
|
||||||
|
|
||||||
# 3. Validate nginx config (if docker is available)
|
# 3. Report
|
||||||
echo "[3/3] Validating nginx config..."
|
echo "[3/3] Build complete"
|
||||||
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
|
|
||||||
|
|
||||||
echo "=== Build complete: $count sites ==="
|
echo "=== Build complete: $count sites ==="
|
||||||
|
|||||||
Reference in New Issue
Block a user