Files
delivery-tracker/.githooks/pre-push

38 lines
946 B
Bash
Executable File

#!/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..."