#!/bin/bash # Build and push all nxtgauge backend services set -e REGISTRY="registry.nxtgauge.com" REGISTRY_USER="admin" REGISTRY_PASS="Ashwin@2026" # Login to registry echo "Logging into registry..." echo "$REGISTRY_PASS" | docker login $REGISTRY -u $REGISTRY_USER --password-stdin cd /home/ashwin/nxtgauge-projects/nxtgauge-backend-rust # Get current git SHA for tagging SHA=$(git rev-parse --short HEAD) echo "Building with SHA tag: $SHA" # Services to build SERVICES=( "catering-services" "companies" "cron" "customers" "developers" "employees" "fitness-trainers" "gateway" "graphic-designers" "job-seekers" "jobs" "leads" "makeup-artists" "payments" "photographers" "social-media-managers" "tutors" "ugc-content-creators" "users" "video-editors" ) # Build each service for service in "${SERVICES[@]}"; do echo "" echo "==================================" echo "Building $service..." echo "==================================" # Get binary name (convert dashes to underscores for Rust naming) bin_name=$(echo "$service" | tr '-' '_') # Check if Dockerfile exists if [ ! -f "apps/$service/Dockerfile" ]; then echo "Dockerfile not found for $service, skipping..." continue fi # Build using the service's Dockerfile docker build -f "apps/$service/Dockerfile" \ -t "$REGISTRY/nxtgauge-rust-$service:$SHA" \ -t "$REGISTRY/nxtgauge-rust-$service:latest" \ . # Push images echo "Pushing $service:$SHA..." docker push "$REGISTRY/nxtgauge-rust-$service:$SHA" docker push "$REGISTRY/nxtgauge-rust-$service:latest" echo "$service built and pushed successfully!" done echo "" echo "==================================" echo "All services built and pushed!" echo "=================================="