-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathMakefile
89 lines (77 loc) · 2.36 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
BUILDER_IMAGE?=pxdocs:developer
SEARCH_INDEX_IMAGE?=pxdocs-search-index:developer
DEPLOYMENT_IMAGE?=pxdocs-deployment:developer
.PHONY: image
image:
docker build -t $(BUILDER_IMAGE) .
.PHONY: search-index-image
search-index-image:
docker build -t $(SEARCH_INDEX_IMAGE) themes/pxdocs-tooling/deploy/algolia
.PHONY: deployment-image
deployment-image:
cp -r themes/pxdocs-tooling/deploy/nginx nginx_build_folder
cp -r public nginx_build_folder/hugo_public
cat public/redirects.json | docker run --rm -i stedolan/jq -r '.[] | "rewrite ^\(.from)$$ \(.to) permanent;"' > nginx_build_folder/pxdocs-directs.conf
docker build -t $(DEPLOYMENT_IMAGE) nginx_build_folder
rm -rf nginx_build_folder
.PHONY: update-theme
update-theme:
git submodule init
git submodule update
git submodule foreach git checkout master
git submodule foreach git pull origin master
.PHONY: develop
develop: image
docker run -ti --rm \
--name pxdocs-develop \
-e VERSIONS_ALL \
-e VERSIONS_CURRENT \
-e VERSIONS_BASE_URL \
-e ALGOLIA_APP_ID \
-e ALGOLIA_API_KEY \
-e ALGOLIA_INDEX_NAME \
-e TRAVIS_BRANCH \
-p 1313:1313 \
-v "$(PWD):/pxdocs" \
$(BUILDER_IMAGE) server --bind=0.0.0.0 --disableFastRender
.PHONY: publish-docker
publish-docker:
docker run --rm \
--name pxdocs-publish \
-e VERSIONS_ALL \
-e VERSIONS_CURRENT \
-e VERSIONS_BASE_URL \
-e ALGOLIA_APP_ID \
-e ALGOLIA_API_KEY \
-e ALGOLIA_INDEX_NAME \
-e TRAVIS_BRANCH \
-v "$(PWD):/pxdocs" \
$(BUILDER_IMAGE) -v --debug --gc --ignoreCache --cleanDestinationDir
.PHONY: search-index-docker
search-index-docker:
docker run --rm \
--name pxdocs-search-index \
-v "$(PWD)/public/algolia.json:/app/indexer/public/algolia.json" \
-e ALGOLIA_APP_ID \
-e ALGOLIA_API_KEY \
-e ALGOLIA_ADMIN_KEY \
-e ALGOLIA_INDEX_NAME \
-e ALGOLIA_INDEX_FILE=public/algolia.json \
$(SEARCH_INDEX_IMAGE)
.PHONY: start-deployment-container
start-deployment-container:
docker run -d \
--name pxdocs-deployment \
$(DEPLOYMENT_IMAGE)
.PHONY: stop-deployment-container
stop-deployment-container:
docker rm -f pxdocs-deployment
.PHONY: check-links
check-links:
docker run --rm \
--link pxdocs-deployment:pxdocs-deployment \
linkchecker/linkchecker http://pxdocs-deployment --check-extern
.PHONY: publish
publish: image publish-docker
.PHONY: search-index
search-index: image search-index-image publish-docker search-index-docker