45 lines
1.2 KiB
Bash
Executable File
45 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
APP_PORT="${APP_PORT:-3910}"
|
|
BACKEND_PORT="${BACKEND_PORT:-3001}"
|
|
export API_PROXY_TARGET="${API_PROXY_TARGET:-http://127.0.0.1:${BACKEND_PORT}}"
|
|
export NEXT_TELEMETRY_DISABLED=1
|
|
|
|
if [[ -f ".env" ]]; then
|
|
set -a
|
|
source .env
|
|
set +a
|
|
fi
|
|
|
|
if [[ -z "${DATABASE_URL:-}" ]]; then
|
|
echo "DATABASE_URL fehlt. Beispiel:"
|
|
echo " export DATABASE_URL='postgresql://user:pass@localhost:5432/tickettracker'"
|
|
exit 1
|
|
fi
|
|
|
|
NODE_MAJOR="$(node -p 'Number(process.versions.node.split(".")[0])' 2>/dev/null || echo 0)"
|
|
|
|
if [[ "${NODE_MAJOR}" -lt 20 ]]; then
|
|
echo "Das Next/shadcn-Framework braucht lokal Node >= 20.9, empfohlen Node 22."
|
|
echo "Aktuell ist Node ${NODE_MAJOR:-unbekannt} aktiv."
|
|
echo "Es wird kein Docker-Container gebaut oder gestartet."
|
|
exit 1
|
|
fi
|
|
|
|
npm run build
|
|
|
|
cleanup() {
|
|
if [[ -n "${BACKEND_PID:-}" ]]; then
|
|
kill "${BACKEND_PID}" 2>/dev/null || true
|
|
fi
|
|
}
|
|
trap cleanup EXIT INT TERM
|
|
|
|
echo "Starte Backend auf Port ${BACKEND_PORT}"
|
|
SERVE_FRONTEND=false PORT="${BACKEND_PORT}" npm run start --workspace backend &
|
|
BACKEND_PID=$!
|
|
|
|
echo "Starte Frontend auf http://localhost:${APP_PORT}"
|
|
PORT="${APP_PORT}" npm run start --workspace frontend
|