-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
74 lines (56 loc) · 2.31 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
VERSION = $(shell python3 -c "import mr_poopybutthole as mpb; print(mpb.__version__)")
.PHONY: default
default: help
# generate help info from comments: thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
help: ## help information about make commands
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: start
start: build run ## ALIAS: build, run
.PHONY: restart
restart: stop build run ## ALIAS: stop, build, run
.PHONY: stop
stop: ## stop the Docker container
docker stop mr-poopybutthole
.PHONY: build
build: ## build the bot's Docker image
docker image build --tag eaglerock/mr-poopybutthole:${VERSION} .
.PHONY: build-micro
build-micro: ## build and push the bot's Docker image for local microk8s repository
docker image build --tag eaglerock/mr-poopybutthole:${VERSION}-arm .
docker image push eaglerock/mr-poopybutthole:${VERSION}-arm
.PHONY: promote-micro
promote-micro: ## promote the image to stable on microk8s repository
docker image tag eaglerock/mr-poopybutthole:${VERSION}-arm eaglerock/mr-poopybutthole:stable-arm
docker image push eaglerock/mr-poopybutthole:stable-arm
.PHONY: push
push: ## push the version to Docker hub
docker image tag eaglerock/mr-poopybutthole:${VERSION} eaglerock/mr-poopybutthole:latest
docker image push eaglerock/mr-poopybutthole:${VERSION}
docker image push eaglerock/mr-poopybutthole:latest
.PHONY: promote
promote: ## promote the image to stable
docker image tag eaglerock/mr-poopybutthole:${VERSION} eaglerock/mr-poopybutthole:stable
docker image push eaglerock/mr-poopybutthole:stable
.PHONY: run
run: ## run the bot inside Docker
docker run -d --rm --name mr-poopybutthole mr-poopybutthole:${VERSION}
.PHONY: log
log: ## display the Docker container's logs and save to a logfile
docker logs -f mr-poopybutthole | tee mr-poopybutthole.log
.PHONY: env
env: ## set up a local development environment
pip install pipenv
pipenv install --dev
.PHONY: local
local: ## run the bot locally
pipenv run python mr-poopybutthole.py
.PHONY: dev
dev: ## run the bot locally in development mode
pipenv run python mr-poopybutthole.py --dev
.PHONY: test
test: ## run pytest unit tests
@echo "Not done yet!"
.PHONY: lint
lint: ## lint all code with black
black .