@@ -71,4 +71,52 @@ lintinsights:
7171 @rm schema.cue
7272 @echo " > Linting security-insights.yml complete."
7373
74- PHONY : tidy test testcov lintcue cuegen dirtycheck lintinsights
74+ # Documentation site targets
75+ CONTAINER_CMD := $(shell command -v podman 2> /dev/null || command -v docker 2> /dev/null)
76+ VOLUME_FLAGS := $(shell [ "$$(uname -s ) " = "Linux" ] && echo ":Z" || echo "")
77+
78+ check-container :
79+ @if [ -z " $( CONTAINER_CMD) " ]; then \
80+ echo " ERROR: Neither podman nor docker found." ; \
81+ exit 1; \
82+ fi
83+
84+ serve : check-container
85+ @echo " > Starting Jekyll documentation site..."
86+ @echo " > Using container runtime: $( CONTAINER_CMD) "
87+ @$(CONTAINER_CMD ) stop gemara-docs 2> /dev/null || true
88+ @$(CONTAINER_CMD ) rm gemara-docs 2> /dev/null || true
89+ @echo " > Site will be available at: http://localhost:4000"
90+ @echo " "
91+ @$(CONTAINER_CMD ) run --rm \
92+ --name gemara-docs \
93+ --volume=" $$ PWD/docs:/srv/jekyll$( VOLUME_FLAGS) " \
94+ --publish 4000:4000 \
95+ --publish 35729:35729 \
96+ docker.io/jekyll/jekyll:latest \
97+ jekyll serve --host 0.0.0.0 --livereload --force_polling
98+
99+ build : check-container
100+ @echo " > Building Jekyll documentation site..."
101+ @$(CONTAINER_CMD ) run --rm \
102+ --volume=" $$ PWD/docs:/srv/jekyll$( VOLUME_FLAGS) " \
103+ docker.io/jekyll/jekyll:latest \
104+ jekyll build
105+
106+ clean : check-container
107+ @echo " > Cleaning generated files..."
108+ @rm -rf docs/_site docs/.jekyll-cache docs/.jekyll-metadata
109+ @echo " > Stopping and removing any running containers..."
110+ @$(CONTAINER_CMD ) stop gemara-docs 2> /dev/null || true
111+ @$(CONTAINER_CMD ) rm gemara-docs 2> /dev/null || true
112+ @echo " > Clean complete!"
113+
114+ stop : check-container
115+ @echo " > Stopping documentation server..."
116+ @$(CONTAINER_CMD ) stop gemara-docs 2> /dev/null || true
117+ @$(CONTAINER_CMD ) rm gemara-docs 2> /dev/null || true
118+ @echo " > Server stopped!"
119+
120+ restart : stop serve
121+
122+ .PHONY : tidy test testcov lintcue cuegen dirtycheck lintinsights serve build clean stop restart check-container
0 commit comments