#!/bin/bash # CHORUS Services - Build and Push Script # Builds all Docker images and pushes them to the local registry set -e REGISTRY="registry.home.deepblack.cloud" REGISTRY_USER="tony" REGISTRY_PASS="silverfrond[1392]" TAG="latest" # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' # No Color # Print colored output print_info() { echo -e "${BLUE}[INFO]${NC} $1" } print_success() { echo -e "${GREEN}[SUCCESS]${NC} $1" } print_warning() { echo -e "${YELLOW}[WARNING]${NC} $1" } print_error() { echo -e "${RED}[ERROR]${NC} $1" } # Docker registry login docker_login() { print_info "Logging into Docker registry: $REGISTRY" echo "$REGISTRY_PASS" | docker login "$REGISTRY" --username "$REGISTRY_USER" --password-stdin print_success "Successfully logged into registry" } # Build and push a single image build_and_push() { local name=$1 local context=$2 local dockerfile=${3:-"Dockerfile"} local image_name="$REGISTRY/tony/chorus-${name}:$TAG" print_info "Building $name from $context" if [ -f "$context/$dockerfile" ]; then docker build -t "$image_name" -f "$context/$dockerfile" "$context" print_success "Built $image_name" print_info "Pushing $image_name to registry" docker push "$image_name" print_success "Pushed $image_name" else print_error "Dockerfile not found: $context/$dockerfile" return 1 fi } # Main build process main() { print_info "Starting CHORUS Services build and push process" # Login to registry docker_login # Build and push all images print_info "Building all CHORUS Services components..." # WHOOSH Backend if [ -d "modules/whoosh/backend" ]; then build_and_push "whoosh-backend" "modules/whoosh/backend" else print_warning "WHOOSH backend directory not found - skipping" fi # WHOOSH Frontend if [ -d "modules/whoosh/frontend" ]; then build_and_push "whoosh-frontend" "modules/whoosh/frontend" else print_warning "WHOOSH frontend directory not found - skipping" fi # BZZZ Coordinator if [ -d "modules/bzzz" ]; then build_and_push "bzzz-coordinator" "modules/bzzz" else print_warning "BZZZ directory not found - skipping" fi # SLURP Curator if [ -d "modules/slurp" ]; then build_and_push "slurp-curator" "modules/slurp" else print_warning "SLURP Curator directory not found - skipping" fi # SLURP RL Tuner if [ -d "modules/slurp" ] && [ -f "modules/slurp/Dockerfile.rl-tuner" ]; then build_and_push "slurp-rl-tuner" "modules/slurp" "Dockerfile.rl-tuner" else print_warning "SLURP RL Tuner dockerfile not found - skipping" fi # Marketing Website if [ -d "modules/website" ]; then build_and_push "website" "modules/website" else print_warning "Website directory not found - skipping" fi print_success "All CHORUS Services images built and pushed successfully!" # List pushed images print_info "Pushed images:" echo " - $REGISTRY/tony/chorus-whoosh-backend:$TAG" echo " - $REGISTRY/tony/chorus-whoosh-frontend:$TAG" echo " - $REGISTRY/tony/chorus-bzzz-coordinator:$TAG" echo " - $REGISTRY/tony/chorus-slurp-curator:$TAG" echo " - $REGISTRY/tony/chorus-slurp-rl-tuner:$TAG" echo " - $REGISTRY/tony/chorus-website:$TAG" } # Handle command line arguments case "${1:-}" in "login") docker_login ;; "whoosh-backend") docker_login build_and_push "whoosh-backend" "modules/whoosh/backend" ;; "whoosh-frontend") docker_login build_and_push "whoosh-frontend" "modules/whoosh/frontend" ;; "bzzz") docker_login build_and_push "bzzz-coordinator" "modules/bzzz" ;; "slurp-curator") docker_login build_and_push "slurp-curator" "modules/slurp" ;; "slurp-rl-tuner") docker_login build_and_push "slurp-rl-tuner" "modules/slurp" "Dockerfile.rl-tuner" ;; "website") docker_login build_and_push "website" "modules/website" ;; "help"|"-h"|"--help") echo "CHORUS Services Build and Push Script" echo "" echo "Usage: $0 [COMMAND]" echo "" echo "Commands:" echo " (no args) Build and push all images" echo " login Login to Docker registry only" echo " whoosh-backend Build and push WHOOSH backend only" echo " whoosh-frontend Build and push WHOOSH frontend only" echo " bzzz Build and push BZZZ coordinator only" echo " slurp-curator Build and push SLURP Curator only" echo " slurp-rl-tuner Build and push SLURP RL Tuner only" echo " website Build and push marketing website only" echo " help Show this help message" ;; *) main ;; esac