kirche-einfach/frontend/entrypoint.sh

20 lines
585 B
Bash

#!/bin/sh
# Frontend entrypoint (dev + prod).
# FRONTEND_MODE=dev (compose default) runs the HMR dev server.
# FRONTEND_MODE=preview (prod .env) builds once and serves the bundle.
set -e
cd /srv/kirche-einfach/frontend
# node_modules lives in the repo bind-mount (no named volume by design):
# install on first start after a fresh checkout (dev and prod).
if [ ! -x "node_modules/.bin/vite" ]; then
npm ci
fi
if [ "${FRONTEND_MODE:-dev}" = "dev" ]; then
exec npm run dev -- --host 0.0.0.0 --port 3000
else
npm run build
exec npm run preview -- --host 0.0.0.0 --port 3000
fi