#!/bin/bash
# Healthcheck for Forgejo

# Check if the container is running
if ! docker ps --filter "name=forgejo" --filter "status=running" | grep -q "forgejo"; then
    echo "[FAIL] Forgejo container is not running"
    exit 1
fi

# Check API health endpoint
if ! curl -sf http://localhost:3000/api/healthz > /dev/null; then
    echo "[FAIL] Forgejo API is not responding"
    exit 1
fi

echo "[OK] Forgejo is healthy"
exit 0
