wip: oci image management

This commit is contained in:
loveuer
2025-11-09 15:19:11 +08:00
commit 8de8234372
58 changed files with 6142 additions and 0 deletions

39
dev.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Run backend (Go) and frontend (Vite) together; stop both on Ctrl+C
set -euo pipefail
# Always run from repo root
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
BACKEND_ADDR=${BACKEND_ADDR:-0.0.0.0:8080}
DATA_DIR=${DATA_DIR:-./x-storage}
cleanup() {
echo "\n[dev] Shutting down..."
# Kill all background jobs spawned by this script
jobs -p | xargs -r kill 2>/dev/null || true
# Extra wait to ensure graceful shutdown
wait || true
}
trap cleanup INT TERM
# Start backend
(
echo "[dev] Starting backend on $BACKEND_ADDR (data-dir=$DATA_DIR)"
go run cmd/server/main.go -debug -address "$BACKEND_ADDR" -data-dir "$DATA_DIR"
) &
BACKEND_PID=$!
# Start frontend
(
echo "[dev] Starting frontend dev server (Vite)"
npm --prefix frontend run dev
) &
FRONTEND_PID=$!
echo "[dev] Backend PID: $BACKEND_PID, Frontend PID: $FRONTEND_PID"
echo "[dev] Press Ctrl+C to stop both..."
# Wait for both processes to exit (trap will handle Ctrl+C)
wait $BACKEND_PID $FRONTEND_PID