29 lines
683 B
Bash
29 lines
683 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
export APP_DATA_DIR="${APP_DATA_DIR:-/app/data}"
|
|
export HOSTNAME="0.0.0.0"
|
|
|
|
uvicorn backend.app.main:app --host 127.0.0.1 --port 8000 &
|
|
backend_pid=$!
|
|
|
|
cleanup() {
|
|
kill "$backend_pid" 2>/dev/null || true
|
|
}
|
|
trap cleanup EXIT INT TERM
|
|
|
|
cd frontend
|
|
|
|
if [ -f ".next/standalone/server.js" ]; then
|
|
mkdir -p .next/standalone/.next
|
|
rm -rf .next/standalone/.next/static .next/standalone/public
|
|
cp -r .next/static .next/standalone/.next/static
|
|
if [ -d "public" ]; then
|
|
cp -r public .next/standalone/public
|
|
fi
|
|
cd .next/standalone
|
|
PORT="${PORT:-3000}" node server.js
|
|
else
|
|
npm run start -- --hostname 0.0.0.0 --port "${PORT:-3000}"
|
|
fi
|