build system updates

This commit is contained in:
Mistral Vibe
2026-04-10 00:35:15 +02:00
parent 8ea114755a
commit 21ff7167c4
4 changed files with 59 additions and 78 deletions

View File

@@ -1,78 +0,0 @@
.PHONY: up down build logs migrate seed test test-api test-worker test-watcher lint check format
up: validate-env
docker compose up -d
validate-env:
bash scripts/validate-env.sh
down:
docker compose down
build: check
docker compose build
logs:
docker compose logs -f
# ── Database ──────────────────────────────────────────────────────────────────
migrate:
docker compose exec api alembic upgrade head
migrate-auto:
docker compose exec api alembic revision --autogenerate -m "$(m)"
# ── Setup ─────────────────────────────────────────────────────────────────────
setup: validate-env up
@echo "Waiting for Nextcloud to initialize (this can take ~60s)..."
@sleep 60
bash scripts/nc-setup.sh
bash scripts/seed.sh
# ── Testing ───────────────────────────────────────────────────────────────────
test: test-api test-worker test-watcher
test-api:
cd api && uv run pytest tests/ -v --cov=src/rehearsalhub --cov-report=term-missing
test-worker:
cd worker && uv run pytest tests/ -v --cov=src/worker --cov-report=term-missing
test-watcher:
cd watcher && uv run pytest tests/ -v --cov=src/watcher --cov-report=term-missing
test-integration:
cd api && uv run pytest tests/integration/ -v -m integration
# ── Linting & type checking ───────────────────────────────────────────────────
# check: run all linters + type checkers locally (fast, no Docker)
check: lint typecheck-web
lint:
cd api && uv run ruff check src/ tests/ && uv run mypy src/
cd worker && uv run ruff check src/ tests/
cd watcher && uv run ruff check src/ tests/
cd web && npm run lint
typecheck-web:
cd web && npm run typecheck
format:
cd api && uv run ruff format src/ tests/
cd worker && uv run ruff format src/ tests/
cd watcher && uv run ruff format src/ tests/
# ── Dev helpers ───────────────────────────────────────────────────────────────
shell-api:
docker compose exec api bash
shell-db:
docker compose exec db psql -U $${POSTGRES_USER} -d $${POSTGRES_DB}
shell-redis:
docker compose exec redis redis-cli

View File

@@ -48,6 +48,8 @@ Files are **never copied** to RehearsalHub servers. The platform reads recording
## Quick start ## Quick start
> **Docker Registry Setup**: For production deployments using Gitea registry, see [DOCKER_REGISTRY.md](DOCKER_REGISTRY.md)
### 1. Configure environment ### 1. Configure environment
```bash ```bash

View File

@@ -251,3 +251,19 @@ tasks:
interactive: true interactive: true
cmds: cmds:
- "{{.COMPOSE}} exec redis redis-cli" - "{{.COMPOSE}} exec redis redis-cli"
# ── Registry ──────────────────────────────────────────────────────────────────
registry:login:
desc: Login to Gitea Docker registry
cmds:
- docker login git.sschuhmann.de
registry:build:
desc: Build all images with version tag (requires git tag)
cmds:
- bash scripts/build-and-push.sh
registry:push:
desc: Build and push all images to Gitea registry
deps: [registry:login, registry:build]

41
scripts/build-and-push.sh Executable file
View File

@@ -0,0 +1,41 @@
#!/bin/bash
set -euo pipefail
# Configuration
REGISTRY="git.sschuhmann.de/sschuhmann/rehearshalhub"
COMPONENTS=("api" "web" "worker" "watcher")
# Get version from git tag
get_version() {
local tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [[ -z "$tag" ]]; then
echo "Error: No git tags found. Please create a tag first (e.g., git tag v1.0.0)" >&2
exit 1
fi
# Remove v prefix if present for semantic versioning
echo "${tag#v}"
}
# Main build and push function
build_and_push() {
local version=$1
echo "Building and pushing version: $version"
for component in "${COMPONENTS[@]}"; do
echo "Building $component..."
docker build -t "$REGISTRY/$component-$version" -f "$component/Dockerfile" --target production "$component"
echo "Pushing $component-$version..."
docker push "$REGISTRY/$component-$version"
# Also tag as latest for convenience
docker tag "$REGISTRY/$component-$version" "$REGISTRY/$component-latest"
docker push "$REGISTRY/$component-latest"
done
echo "All components built and pushed successfully!"
}
# Execute
VERSION=$(get_version)
build_and_push "$VERSION"