#!/bin/bash set -euo pipefail echo "[integration] Starting Docker daemon..." # Start Docker daemon in the background dockerd-entrypoint.sh dockerd & DOCKERD_PID=$! # Wait for Docker daemon to be ready echo "[integration] Waiting for Docker daemon..." timeout 30 sh -c 'until docker info >/dev/null 2>&1; do sleep 1; done' echo "[integration] Docker daemon ready" echo "[integration] Starting Harb stack..." cd /workspace # Build kraiken-lib if not already built if [ ! -d "kraiken-lib/dist" ] || [ -z "$(ls -A kraiken-lib/dist 2>/dev/null)" ]; then echo "[integration] Building kraiken-lib..." ./scripts/build-kraiken-lib.sh fi # Start the stack using dev.sh echo "[integration] Launching stack via dev.sh..." ./scripts/dev.sh start echo "[integration] Stack started successfully" echo "[integration] Health endpoint: http://localhost:8081/api/graphql" echo "[integration] Keeping container alive..." # Keep the container running and forward signals to dockerd trap "echo '[integration] Shutting down...'; ./scripts/dev.sh stop; kill $DOCKERD_PID; exit 0" SIGTERM SIGINT # Wait for dockerd or run custom command if provided if [ $# -gt 0 ]; then echo "[integration] Executing: $*" exec "$@" else wait $DOCKERD_PID fi