Scaffold complete repo structure: - 28 static sites extracted from running containers on mlake - 2 dynamic sites (dasbes.de, dumusst.com) marked for separate handling - Template system with 6 templates (person-dark/light, product-dark, editorial, fun, minimal) - Shared CSS (variables, responsive, animations, noise overlay) - nginx config generator with multi-domain alias support - Build script with Docker-based nginx validation - add-site.sh helper for scaffolding new domains - Dockerfile for single nginx:alpine container Sites: clemensplassmann.de, danosi.de, deinesei.de, derkaiseristnackt.de, elefantenhor.de, fragina.de, frenchkis.de, ichbinaufbali.de, ichbinaufbarley.de, insain.de, julietensity.de, kainco.de (+keinco.de), kainstress.de, keinefreun.de, knzlmgmt.de, kopffrai.de, legalais.de, machesdocheinfach.de, mai-otto.de (+otto.flexsiebels.de, ottomatisch.de, ichbinotto.de), martinsiebels.de, matthiasbreier.de, osterai.de, paragraphenraiter.de, schulfrai.de, smartin3.de, sorgenfrai.de, vonschraitter.de, wartebitte.de Refs: otto#341
60 lines
2.1 KiB
Bash
Executable File
60 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Build all sites: generate nginx.conf, render templates, prepare build/ directory
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
|
BUILD_DIR="$SCRIPT_DIR/build"
|
|
|
|
echo "=== Onepager Build ==="
|
|
|
|
# Clean build directory
|
|
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"
|
|
|
|
# 2. Build each site
|
|
echo "[2/3] Building sites..."
|
|
count=0
|
|
for site_dir in "$SCRIPT_DIR/sites"/*/; do
|
|
[ -f "$site_dir/site.yaml" ] || continue
|
|
domain=$(basename "$site_dir")
|
|
template=$(yq -r '.template // "custom"' "$site_dir/site.yaml")
|
|
|
|
mkdir -p "$BUILD_DIR/$domain"
|
|
|
|
if [ "$template" = "custom" ]; then
|
|
# Copy everything except site.yaml
|
|
find "$site_dir" -maxdepth 1 -not -name site.yaml -not -path "$site_dir" -exec cp -r {} "$BUILD_DIR/$domain/" \;
|
|
echo " [custom] $domain"
|
|
else
|
|
template_file="$SCRIPT_DIR/templates/${template}.html"
|
|
if [ ! -f "$template_file" ]; then
|
|
echo " [ERROR] Template '$template' not found for $domain — skipping" >&2
|
|
continue
|
|
fi
|
|
"$SCRIPT_DIR/render.sh" "$site_dir/site.yaml" "$template_file" > "$BUILD_DIR/$domain/index.html"
|
|
# Copy assets if present
|
|
[ -d "$site_dir/assets" ] && cp -r "$site_dir/assets" "$BUILD_DIR/$domain/"
|
|
echo " [${template}] $domain"
|
|
fi
|
|
count=$((count + 1))
|
|
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
|
|
|
|
echo "=== Build complete: $count sites ==="
|