add git hooks for commit validation, auto-suggestions, and Docker build/push automation on git push
This commit is contained in:
37
.githooks/pre-push
Executable file
37
.githooks/pre-push
Executable 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..."
|
||||
Reference in New Issue
Block a user