forked from d2iq-archive/dcos-docs-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
64 lines (49 loc) · 1.8 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
.PHONY: build-development clean reduce-pages
clean: ## Remove all build folders
./scripts/clean.sh
#
# Link Management
#
redirects-replace-old:
./scripts/links/redirects_replace_old.sh
#
# Build
#
## Build static content
build-development:
npm run dev
#
# Docker
#
docker-site-build: ## Build site docker image. Required env vars: ALGOLIA_PRIVATE_KEY
./scripts/build-site.sh
docker-site-run: ## Run site container.
docker-compose up -d docs
docker-site-check-links: ## Run link checker test
docker-compose up test
# Docker Live Edit
LIVEEDIT_IMAGE := dcos-docs-liveedit
LIVEEDIT_HOST_PORT ?= 3000
LIVEEDIT_PAGES_SRC_ABS_PATH ?= $(shell pwd)/pages/mesosphere/dcos/2.1
LIVEEDIT_PAGES_DST_REL_PATH ?= mesosphere/dcos/2.1
LIVEEDIT_RENDER_PATH_PATTERN ?= $(LIVEEDIT_PAGES_DST_REL_PATH)/**
docker-liveedit-image: ## Install dependencies and build the site. Takes approximately 15 minutes.
docker build \
-f docker/Dockerfile.liveedit \
-t $(LIVEEDIT_IMAGE) \
.
docker-liveedit: ## Start a liveediting container
@test -n "$$(docker image ls --quiet $(LIVEEDIT_IMAGE))" || (echo "Image '$(LIVEEDIT_IMAGE)' not found. Did you already run 'make docker-liveedit-image'?"; exit 1)
# Note: --mount consistency=delegated for MacOS. See https://docs.docker.com/storage/bind-mounts/#configure-mount-consistency-for-macos.
docker run -it --rm \
--env RENDER_PATH_PATTERN=$(LIVEEDIT_RENDER_PATH_PATTERN) \
--mount type=bind,src=$(LIVEEDIT_PAGES_SRC_ABS_PATH),dst=/dcos-docs-site/pages/$(LIVEEDIT_PAGES_DST_REL_PATH),consistency=delegated,readonly \
--publish 127.0.0.1:$(LIVEEDIT_HOST_PORT):3000 \
--publish 127.0.0.1:35729:35729 \
$(LIVEEDIT_IMAGE)
#
# Help
#
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help