#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
IMAGE_NAME="${CI_IMAGE_NAME:-xiaoxia-ci-python:3.12}"

echo "🔨 Building CI image: $IMAGE_NAME"
docker build \
  -f "$REPO_ROOT/infra/docker/ci.Dockerfile" \
  -t "$IMAGE_NAME" \
  "$REPO_ROOT"

echo "✅ CI image ready: $IMAGE_NAME"
