# Root Makefile for CMMC-Platform local dev compose = podman-compose -f dev-compose.yaml # ---------------------------------------------------------- # Helpers # ---------------------------------------------------------- create-proxy-net: @podman network exists nginx-proxy || podman network create nginx-proxy # probe external Keycloak once and cache the flag check-idp: @echo "🔍 Probing $(KEYCLOAK_URL) for existing Keycloak..." @if curl -sf "${KEYCLOAK_URL:-http://keycloak.local:8080}/realms/master" >/dev/null ; \ then echo "🥳 External Keycloak detected!"; echo 1 >.idp_flag ; \ else echo "🛠 No external Keycloak found."; echo 0 >.idp_flag ; fi # ---------------------------------------------------------- # Lifecycle targets # ---------------------------------------------------------- build: ## Build FastAPI image podman build -t cmmc-fastapi:latest -f .container-images/fastapi.Dockerfile . up: create-proxy-net check-idp ## Start stack (auto-starts Keycloak only if needed) @if [ "`cat .idp_flag`" = "1" ]; then \ $(compose) up -d ; \ else \ $(compose) --profile idp up -d ; \ fi down: ## Stop stack $(compose) down logs: ## Tail logs $(compose) logs -f test: ## Run pytest PYTHONPATH=. pytest -q .PHONY: build up down logs test create-proxy-net check-idp