-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
99 lines (76 loc) · 3.15 KB
/
Copy pathMakefile
File metadata and controls
99 lines (76 loc) · 3.15 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#----------------------
# Parse makefile arguments
#----------------------
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(RUN_ARGS):;@:)
#----------------------
# Silence GNU Make
#----------------------
ifndef VERBOSE
MAKEFLAGS += --no-print-directory
endif
#----------------------
# Load .env file
#----------------------
ifneq ("$(wildcard .env)","")
include .env
export
else
endif
DRUNPREFIX=
ifeq ($(OS),Windows_NT)
DRUNPREFIX = winpty
endif
COMPOSE_COMMAND=docker-compose
ifeq ($(APP_ENV),production)
COMPOSE_COMMAND=docker-compose -f docker-compose.yml -f docker-compose.prod.yml
endif
HELP_NAME := docs
HELP_FUN = %help; while (<>) { /^([A-Za-z0-9_-]+)\s*:.*\#\#(?:@([A-Za-z0-9_-]+))?\s(.*)$$/ or next; push @{$$help{$$2 || "other"}}, [$$1, $$3]; $$width = length($$1) if length($$1) > $$width } print "\e[1;97m$(or $(HELP_NAME),$(notdir $(CURDIR)))\e[0m\n\n"; for $$category (sort keys %help) { print "\e[1;97m$$category\e[0m\n"; for $$entry (@{$$help{$$category}}) { printf " \e[1;32m%-*s\e[0m \e[90m%s\e[0m\n", $$width, $$entry->[0], $$entry->[1] } }
help: ##@other Show this help.
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)
#----------------------
# docs
#----------------------
docs-generate: ##@documentation Generate docs pages and example manifest
@cd backend && go run . docs:generate
docs-proof-refresh: ##@documentation Refresh checked-in proof statistics from sibling repositories
@cd docs && npm run proof:refresh
docs-proof-check: ##@documentation Verify checked-in proof statistics match sibling repositories
@cd docs && npm run proof:check
docs-scenarios-check: ##@documentation Verify generated scenario pages match framework specs
@cd ../goforj && go run ./cmd/forj scenario:generate --all --check
docs-build: docs-proof-check docs-scenarios-check ##@documentation Verify generated evidence and build VitePress docs
@cd docs && npm run build
docs-embed: ##@documentation Copy built docs into backend embed folder
@rm -rf backend/frontend/dist
@mkdir -p backend/frontend/dist
@cp -R docs/.vitepress/dist/. backend/frontend/dist/
docs-package: ##@documentation Generate + build docs and stage for backend
@$(MAKE) docs-generate
@$(MAKE) docs-build
@$(MAKE) docs-embed
#----------------------
# docker
#----------------------
DOCKER_PROD_IMAGE ?= docs-web:latest
DOCKER_PROD_PUSH ?= 0
docker-build-prod: ##@docker Build the production web image
@docker buildx build \
-f containers/web/Dockerfile \
--build-arg GA_MEASUREMENT_ID=$(GA_MEASUREMENT_ID) \
-t $(DOCKER_PROD_IMAGE) \
$(if $(filter 1 true yes,$(DOCKER_PROD_PUSH)),--push,--load) \
.
docker-package-prod: docker-generate-prod docker-build-prod ##@docker Generate docs and build the production image
docker-generate-prod: ##@docker Generate docs from upstream repositories in a one-off container
@$(COMPOSE_COMMAND) run --rm --build docs-generate
docker-deploy-prod: ##@docker Generate docs, build prod image, and roll web container
@$(MAKE) docker-package-prod
@$(COMPOSE_COMMAND) up -d --force-recreate web
#----------------------
# build
#----------------------
build: ##@build Build backend binary
@mkdir -p bin
@cd backend && go build -o ../bin/docs .