diff --git a/Makefile b/Makefile deleted file mode 100644 index afaf0bd..0000000 --- a/Makefile +++ /dev/null @@ -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 diff --git a/README.md b/README.md index d1fd8cd..1fad58b 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ Files are **never copied** to RehearsalHub servers. The platform reads recording ## Quick start +> **Docker Registry Setup**: For production deployments using Gitea registry, see [DOCKER_REGISTRY.md](DOCKER_REGISTRY.md) + ### 1. Configure environment ```bash diff --git a/Taskfile.yml b/Taskfile.yml index 3b95075..f3e6a33 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -251,3 +251,19 @@ tasks: interactive: true cmds: - "{{.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] diff --git a/scripts/build-and-push.sh b/scripts/build-and-push.sh new file mode 100755 index 0000000..d43d2e1 --- /dev/null +++ b/scripts/build-and-push.sh @@ -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" \ No newline at end of file