-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
26 lines (20 loc) · 1.02 KB
/
Copy pathMakefile
File metadata and controls
26 lines (20 loc) · 1.02 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
# Build and preview this Carpentries Workbench lesson locally with Docker.
#
# make preview # rebuild the site, then refresh http://localhost:$(PORT)
# make serve # start a local web server for the built site
# make clean # drop the build cache (fixes stale-cache build errors)
LESSON := $(CURDIR)
IMAGE := ghcr.io/carpentries/workbench-docker:latest
PORT := 4321
.PHONY: preview serve clean help
preview: ## rebuild the site into site/docs
docker run --rm --user rstudio -e DISABLE_AUTH=true \
-v "$(LESSON):/home/rstudio/lesson" $(IMAGE) \
Rscript -e 'sandpaper::build_lesson("/home/rstudio/lesson")'
@echo "Built. Open http://localhost:$(PORT) — run 'make serve' if nothing is serving yet."
serve: ## serve site/docs at http://localhost:$(PORT)
python3 -m http.server $(PORT) --bind 0.0.0.0 --directory "$(LESSON)/site/docs"
clean: ## remove the sandpaper build cache
rm -rf "$(LESSON)/site" "$(LESSON)/.cache"
help: ## list targets
@grep -E '^[a-z]+:.*##' $(MAKEFILE_LIST) | sed -E 's/:.*## /\t/'