add git hooks for commit validation, auto-suggestions, and Docker build/push automation on git push

This commit is contained in:
Egor Pozharov
2026-04-21 12:54:39 +06:00
parent bf62714d0d
commit 60dea22ced
5 changed files with 136 additions and 4 deletions

37
.githooks/pre-push Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/bash
# Pre-push hook: build and push Docker images (blocks until complete)
# This ensures push only succeeds after successful build
REGISTRY="gitea.chedius.ru/chedius"
PLATFORM="linux/amd64"
echo "🔨 Building Docker images..."
# Build backend
docker build --platform $PLATFORM -t $REGISTRY/delivery-tracker/backend:latest ./backend || {
echo "❌ Backend build failed"
exit 1
}
# Build frontend
docker build --platform $PLATFORM -t $REGISTRY/delivery-tracker/frontend:latest ./frontend || {
echo "❌ Frontend build failed"
exit 1
}
echo "📤 Pushing Docker images..."
# Push backend
docker push $REGISTRY/delivery-tracker/backend:latest || {
echo "❌ Backend push failed"
exit 1
}
# Push frontend
docker push $REGISTRY/delivery-tracker/frontend:latest || {
echo "❌ Frontend push failed"
exit 1
}
echo "✅ Docker images built and pushed successfully"
echo "📡 Git push will now proceed..."