BangSo/scripts/start-local.sh

36 lines
857 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$repo_dir"
for command_name in docker pnpm; do
if ! command -v "$command_name" >/dev/null 2>&1; then
echo "Missing required command: $command_name" >&2
exit 1
fi
done
if [[ ! -f .env ]]; then
echo "Missing .env. Copy .env.example to .env and set the required local secrets first." >&2
exit 1
fi
if ! docker info >/dev/null 2>&1; then
echo "Docker is not running. Start Docker Desktop and try again." >&2
exit 1
fi
pnpm install --frozen-lockfile
docker compose --env-file .env -f infra/compose/docker-compose.yml up postgres -d --wait
pnpm db:generate
pnpm db:migrate
if ! docker image inspect rakazo/computer:local >/dev/null 2>&1; then
pnpm sandbox:build
fi
echo "Starting BangSo Bot at http://127.0.0.1:5173"
exec pnpm dev