mirror of
https://github.com/andrey271192/Domain_web.git
synced 2026-09-20 14:41:58 +00:00
fix(deploy): sync static assets and nginx CSS route
Copy .next/static and public into standalone after build; serve /_next/static from nginx; verify CSS in install.sh. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
29
scripts/sync-standalone-assets.sh
Executable file
29
scripts/sync-standalone-assets.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copy Next.js static assets into standalone output (required for `node server.js`).
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="${1:-$(cd "$(dirname "$0")/.." && pwd)}"
|
||||
STANDALONE="${ROOT}/.next/standalone"
|
||||
STATIC_SRC="${ROOT}/.next/static"
|
||||
PUBLIC_SRC="${ROOT}/public"
|
||||
|
||||
if [[ ! -d "${STANDALONE}" ]]; then
|
||||
echo "[sync-standalone-assets] No .next/standalone — skipping (non-standalone build?)" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ ! -d "${STATIC_SRC}" ]]; then
|
||||
echo "[sync-standalone-assets] ERROR: missing ${STATIC_SRC} — run npm run build first" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "${STANDALONE}/.next"
|
||||
rm -rf "${STANDALONE}/.next/static"
|
||||
cp -a "${STATIC_SRC}" "${STANDALONE}/.next/static"
|
||||
|
||||
if [[ -d "${PUBLIC_SRC}" ]]; then
|
||||
rm -rf "${STANDALONE}/public"
|
||||
cp -a "${PUBLIC_SRC}" "${STANDALONE}/public"
|
||||
fi
|
||||
|
||||
echo "[sync-standalone-assets] OK: .next/static + public → ${STANDALONE}"
|
||||
Reference in New Issue
Block a user