nxtgauge-gitops/scripts/build-all-services.sh
Ashwin Kumar Sivakumar cbc7fb42e6 fix: restore all services after registry wipe
- Fix PostgreSQL endpoints (now auto-creating correctly)
- Fix Forgejo DB connection
- Update retention to keep 10 SHA tags (was 2, too aggressive)
- Update all deployments to use available tags
- Add missing base images to registry (alpine, node, rust, python)
- Protect base images from retention deletion
2026-06-13 00:25:51 +05:30

77 lines
1.8 KiB
Bash

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