#!/usr/bin/env bash # healthcheck.sh — reports runner health for Docker HEALTHCHECK instruction set -euo pipefail RUNNER_CONFIG_PATH="${RUNNER_CONFIG_PATH:-/config/runner.yaml}" exit_code=0 check_ok() { echo "[HEALTH] OK : $1"; } check_warn() { echo "[HEALTH] WARN : $1"; } check_fail() { echo "[HEALTH] FAIL : $1"; exit_code=1; } # Runner process if pgrep -x act_runner > /dev/null 2>&1; then check_ok "act_runner process is running" else check_fail "act_runner process not found" fi # Config file if [ -f "${RUNNER_CONFIG_PATH}" ]; then check_ok "Config file present at ${RUNNER_CONFIG_PATH}" else check_warn "Config file not found at ${RUNNER_CONFIG_PATH}" fi # Required binaries for bin in act_runner git node npm; do if command -v "$bin" &>/dev/null; then check_ok "Binary present: ${bin}" else check_fail "Binary missing: ${bin}" fi done # Docker socket (warn only — some label configurations don't need it) if [ -S /var/run/docker.sock ]; then if docker info &>/dev/null 2>&1; then check_ok "Docker socket accessible" else check_warn "Docker socket present but not accessible (permission issue?)" fi else check_warn "Docker socket not mounted — Docker build/push workflows will fail" fi exit $exit_code