-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (29 loc) · 1.35 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
ENVIRONMENT ?= dev
VIRTUALENV_PATH ?= venv
DOCKER_IMAGE_PATH ?= sylvanld/blog
DOCKER_IMAGE_TAG ?= dev
DOCKER_IMAGE_NAME ?= $(DOCKER_IMAGE_PATH):$(DOCKER_IMAGE_TAG)
help: ## Show this help
@awk 'BEGIN {FS = ":.*##"; printf "Usage: make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-10s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
$(VIRTUALENV_PATH): # Create virtualenv
virtualenv -p python3 $(VIRTUALENV_PATH)
requires-venv: # Create virtualenv and install dependencies if needed
@[ -d "$(VIRTUALENV_PATH)" ] || make install
install: $(VIRTUALENV_PATH) ## Install build/dev dependencies
$(VIRTUALENV_PATH)/bin/pip install -r requirements/$(ENVIRONMENT).txt
serve: requires-venv ## Start a development server to preview blog
$(VIRTUALENV_PATH)/bin/mkdocs serve
build: requires-venv ## Build static blog as HTML from markdown
$(VIRTUALENV_PATH)/bin/mkdocs build
format: ## Format python plugins code
isort --profile=black plugins/src
black -l 120 plugins/src
image: ## Build docker image
docker build -t $(DOCKER_IMAGE_NAME) .
##date +'%Y.%m.%d.%H.%M'
docker-start: ## Run documentation in docker image
docker run --name blog -d -p 23401:80 $(DOCKER_IMAGE_NAME)
@echo "Blog is running at http://localhost:23401"
docker-stop: ## Stop documentation
docker stop blog
docker rm blog