- Add comprehensive AI plans implementation documentation - Add LiteLLM gateway Kubernetes manifests - Update PostgreSQL and Forgejo deployment configs - Add build-from-binaries script
77 lines
1.6 KiB
Bash
77 lines
1.6 KiB
Bash
#!/bin/bash
|
|
# Build and push service images using pre-compiled binaries
|
|
|
|
set -e
|
|
|
|
REGISTRY="registry.nxtgauge.com"
|
|
|
|
cd /home/ashwin/nxtgauge-projects/nxtgauge-backend-rust
|
|
|
|
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"
|
|
)
|
|
|
|
for svc in "${SERVICES[@]}"; do
|
|
echo ""
|
|
echo "=== Building $svc ==="
|
|
|
|
# Convert to hyphenated name for image
|
|
img_name=$(echo "$svc" | tr '_' '-')
|
|
|
|
# Check if binary exists
|
|
if [ ! -f "target/release/$svc" ]; then
|
|
echo "Building $svc binary..."
|
|
cargo build --release --bin "$svc" 2>&1 || {
|
|
echo "ERROR: Failed to build $svc"
|
|
continue
|
|
}
|
|
fi
|
|
|
|
# Create temp directory for build
|
|
tmpdir=$(mktemp -d)
|
|
cp "target/release/$svc" "$tmpdir/service"
|
|
|
|
# Build minimal image
|
|
cat > "$tmpdir/Dockerfile" << 'EOF'
|
|
FROM scratch
|
|
COPY service /app/service
|
|
COPY --from=alpine:latest /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
USER 65532:65532
|
|
EXPOSE 8000
|
|
ENTRYPOINT ["/app/service"]
|
|
EOF
|
|
|
|
# Build and push
|
|
docker build -t "$REGISTRY/nxtgauge-rust-$img_name:latest" "$tmpdir" 2>&1 || {
|
|
echo "ERROR: Failed to build image for $svc"
|
|
rm -rf "$tmpdir"
|
|
continue
|
|
}
|
|
|
|
docker push "$REGISTRY/nxtgauge-rust-$img_name:latest" 2>&1 || echo "ERROR: Failed to push $svc"
|
|
|
|
rm -rf "$tmpdir"
|
|
echo "✓ $svc pushed"
|
|
done
|
|
|
|
echo ""
|
|
echo "All services built and pushed!"
|