#!/bin/bash

# Build and Push Script for AI Tax Agent
# Builds all service images and pushes them to the registry

set -e

# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m'

log_info() {
    echo -e "${BLUE}ℹ️  $1${NC}"
}

log_success() {
    echo -e "${GREEN}✅ $1${NC}"
}

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"
COMPOSE_FILE="$PROJECT_ROOT/infra/compose/compose.build.yaml"

log_info "Building and pushing images for AI Tax Agent..."
log_info "Using compose file: $COMPOSE_FILE"

# Build images
log_info "Building images..."
docker compose -f "$COMPOSE_FILE" build

# Push images
log_info "Pushing images to registry..."
docker compose -f "$COMPOSE_FILE" push

log_success "All images built and pushed successfully!"
