fix(deploy): korrigiere update.sh Frontend-Standalone-Deployment
Vorher: rsync --delete führte dazu dass FRONTEND_DIR nach dem Sync nur den _build/-Unterordner enthielt statt server.js direkt. Ursache: Next.js standalone spiegelt den absoluten Build-Pfad. Jetzt: FRONTEND_DIR wird vor dem Sync geleert (rm -rf) um veraltete Verzeichnisse zu entfernen; rsync ohne --delete kopiert den korrekten Standalone-Root direkt. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -65,6 +65,7 @@ fi
|
|||||||
|
|
||||||
info "Baue Go Backend..."
|
info "Baue Go Backend..."
|
||||||
cd "$BUILD_DIR"
|
cd "$BUILD_DIR"
|
||||||
|
go mod download
|
||||||
CGO_ENABLED=1 go build -tags xapian -buildvcs=false -o "$BUILD_DIR/archivmail-new" ./cmd/archivmail/
|
CGO_ENABLED=1 go build -tags xapian -buildvcs=false -o "$BUILD_DIR/archivmail-new" ./cmd/archivmail/
|
||||||
log "Go Backend gebaut"
|
log "Go Backend gebaut"
|
||||||
|
|
||||||
@@ -103,14 +104,20 @@ ln -sf "$BIN_DIR/archivmail" /usr/local/bin/archivmail
|
|||||||
log "Backend eingespielt"
|
log "Backend eingespielt"
|
||||||
|
|
||||||
info "Spiele Frontend ein (standalone)..."
|
info "Spiele Frontend ein (standalone)..."
|
||||||
|
# Next.js standalone mirrors the absolute build path — find the dir that contains server.js.
|
||||||
|
# The path is typically: .next/standalone/<build-dir>/server.js
|
||||||
|
STANDALONE_SERVER=$(find "$BUILD_DIR/.next/standalone" -maxdepth 3 -name "server.js" | head -1)
|
||||||
|
[[ -n "$STANDALONE_SERVER" ]] || die "server.js nicht im standalone-Build gefunden"
|
||||||
|
STANDALONE_ROOT=$(dirname "$STANDALONE_SERVER")
|
||||||
|
# Clean destination and copy fresh standalone output
|
||||||
|
rm -rf "$FRONTEND_DIR"
|
||||||
mkdir -p "$FRONTEND_DIR"
|
mkdir -p "$FRONTEND_DIR"
|
||||||
# Next.js standalone mirrors the absolute build path — find the dir that contains server.js
|
rsync -a "$STANDALONE_ROOT/" "$FRONTEND_DIR/"
|
||||||
STANDALONE_ROOT=$(dirname "$(find "$BUILD_DIR/.next/standalone" -name "server.js" | head -1)")
|
# Copy static assets from the full build (standalone doesn't include them)
|
||||||
rsync -a --delete "$STANDALONE_ROOT/" "$FRONTEND_DIR/"
|
|
||||||
mkdir -p "$FRONTEND_DIR/.next/static"
|
mkdir -p "$FRONTEND_DIR/.next/static"
|
||||||
rsync -a --delete "$BUILD_DIR/.next/static/" "$FRONTEND_DIR/.next/static/"
|
rsync -a --delete "$BUILD_DIR/.next/static/" "$FRONTEND_DIR/.next/static/"
|
||||||
if [[ -d "$BUILD_DIR/public" ]]; then
|
if [[ -d "$BUILD_DIR/public" ]]; then
|
||||||
rsync -a --delete "$BUILD_DIR/public/" "$FRONTEND_DIR/public/"
|
rsync -a "$BUILD_DIR/public/" "$FRONTEND_DIR/public/"
|
||||||
fi
|
fi
|
||||||
log "Frontend eingespielt"
|
log "Frontend eingespielt"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user