forked from OpenNMS/opennms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (60 loc) · 2.62 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
##
# Makefile to build OpenNMS docs
##
.PHONY: help docs docs-docker docs-deps docs-deps-docker docs-serve docs-serve-stop docs-clean docs-clean-cache clean-all
.DEFAULT_GOAL := docs
SHELL := /bin/bash -o nounset -o pipefail -o errexit
WORKING_DIRECTORY := $(shell pwd)
DOCKER_ANTORA_IMAGE := opennms/antora:2.3.4-b6293
SITE_FILE := antora-playbook-local.yml
help:
@echo ""
@echo "Makefile to build artifacts for OpenNMS"
@echo ""
@echo "Requirements to build the docs:"
@echo " * Native: Antora installed globally with antora binary in the search path"
@echo " * Docker: Docker installed with access to the official antora/antora image on DockerHub"
@echo ""
@echo "Targets:"
@echo " help: Show this help"
@echo " docs-deps: Test requirements to run Antora from the local system"
@echo " docs-deps-docker: Test requirements to run Antora with Docker"
@echo " docs: Build Antora docs with a local install Antora, default target"
@echo " docs-docker: Build Antora docs with from Docker"
@echo " docs-clean: Clean all build artifacts in build and public directory"
@echo " docs-clean-cache: Clear git repository cache and UI components from .cache directory"
@echo " clean-all: Clean build artifacts and Antora cache"
@echo " docs-serve: Run a local web server with Docker and Nginx to serve the docs locally"
@echo " docs-serve-stop: Stop the local web server for serving the docs"
@echo ""
@echo "Arguments: "
@echo " DOCKER_ANTORA_IMAGE: Antora Docker image to build the documentation, default: $(DOCKER_ANTORA_IMAGE)"
@echo " SITE_FILE: Antora site.yml file to build the site"
@echo ""
@echo "Example: "
@echo " make DOCKER_ANTORA_IMAGE=antora/antora:latest with-docker"
@echo ""
deps-docs:
@command -v antora
deps-docs-docker:
@command -v docker
docs: deps-docs
@echo "Build Antora docs..."
antora --stacktrace $(SITE_FILE)
docs-docker: deps-docs-docker
@echo "Build Antora docs with docker ..."
docker run --rm -v $(WORKING_DIRECTORY):/antora $(DOCKER_ANTORA_IMAGE) --stacktrace generate $(SITE_FILE)
docs-clean:
@echo "Delete build and public artifacts ..."
@rm -rf build public
docs-clean-cache:
@echo "Clean Antora cache for git repositories and UI components ..."
@rm -rf .cache
clean-all: docs-clean docs-clean-cache
docs-serve:
@echo "Start Nginx with public folder as html root ..."
docker run --rm -v $(WORKING_DIRECTORY)/public:/usr/share/nginx/html --name opennms-docs -p 8080:80 -d nginx
docs-serve-stop:
@echo "Stopping Nginx docs server ..."
docker stop opennms-docs
clean-all: docs-clean docs-clean-cache