-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (49 loc) · 1.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
ENVDIR = .env
DOCKER ?= docker
# Possible install and build Nikola, generate the pages
build: ${ENVDIR} ${ENVDIR}/bin/nikola
. ${ENVDIR}/bin/activate \
&& cd stacken \
&& nikola build
# If you like, you can also use docker to build the site
# Add DOCKER="sudo docker" or DOCKER="podman" or something if needed
build-docker:
${DOCKER} build -t w3 .
# Build it, and serve it on http://127.0.0.1:8000/
server: build
. ${ENVDIR}/bin/activate \
&& cd stacken \
&& nikola serve
# Run the docker image instead
# Add DOCKER="sudo docker" or DOCKER="podman" or something if needed
server-docker: build-docker
${DOCKER} run -tip 8000:80 w3
# Like server, but try to autoupdate changes
auto: build
. ${ENVDIR}/bin/activate \
&& cd stacken \
&& nikola auto
# If you like to share a few changes w/o publishing them to the real site
# run this rule, your changes will be published to https://stacken.github.io/w3/
deploy-to-github-pages: ${ENVDIR} ${ENVDIR}/bin/nikola
. ${ENVDIR}/bin/activate \
&& cd stacken \
&& nikola github_deploy
${ENVDIR}/bin/nikola:
. ${ENVDIR}/bin/activate \
&& pip install -r nikola-requirements.txt
# Run this to update nikola-requirements.txt with a fresh version of Nikola
update-nikola:
${DOCKER} run -it --rm -v ${PWD}:/src python:3.8 \
/bin/bash -c "cd /src && make update-nikola-in-docker"
update-nikola-in-docker:
pip install -U Nikola[extras]
pip freeze | grep -v pkg-resources > nikola-requirements.txt
# Run this to clean up, sometimes this is needed to fix the build
clean:
rm -rf stacken/cache
rm -rf stacken/output
rm -rf ${ENVDIR}
rm -rf .tmpenv
${ENVDIR}:
virtualenv -p python3 ${ENVDIR}