#!/bin/bash

# Z.CRM Deployment Script
set -e

echo "🚀 Building Z.CRM Docker Images..."

# Login to Docker Hub
echo "📦 Logging in to Docker Hub..."
echo "_b5pGcG_uSMw@3z" | docker login -u "info@dbtglobal.net" --password-stdin

# Build images
echo "🔨 Building backend image..."
docker build -t info@dbtglobal.net/zerp-backend:latest ./backend

echo "🔨 Building frontend image..."
docker build -t info@dbtglobal.net/zerp-frontend:latest ./frontend

# Push to Docker Hub
echo "⬆️ Pushing backend image..."
docker push info@dbtglobal.net/zerp-backend:latest

echo "⬆️ Pushing frontend image..."
docker push info@dbtglobal.net/zerp-frontend:latest

echo "✅ Build and push completed!"
echo ""
echo "📋 Next steps:"
echo "1. SSH to your server: ssh root@37.60.249.71"
echo "2. Run the deployment commands on the server"
