-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (44 loc) · 1.26 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
MAKEFLAGS += --warn-undefined-variables
SHELL := sh
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := help
.PHONY: help clean run-sam run-docker
## display this help
help:
@ echo 'Usage: make <target>'
@ echo
@ echo 'Available targets are:'
@ awk '/^[[:alnum:]]+([\.\-_][[:alnum:]]*)*:/ { \
if (match(line, /^## (.*)/)) { printf " %s,%s\n", substr($$1, 0, index($$1, ":")-1), substr(line, RSTART + 3, RLENGTH); } \
} { line = $$0 }' $(MAKEFILE_LIST) | sort | column -t -s,
@ echo
## run sam local invoke
run-sam:
### $@
time sam local invoke --skip-pull-image --no-event MyFunction
tree -a
@ echo
@ echo '-----'
@ echo 'CONS:'
@ echo ' - slower that docker, as of runtime, handler & path autodiscovery'
@ echo
## run docker
run-docker:
### $@
time docker run --rm \
-v "$(CURDIR)/code:/var/task" \
"lambci/lambda:python3.7" \
"index.lambda_handler"
tree -a
@ echo
@ echo '-----'
@ echo 'CONS:'
@ echo ' - requires to know upfront: runtime, handler & path'
@ echo
## clean up
clean:
### $@
find . -type f -name '*.pyc' -print0 | xargs -r -0 rm -rf
find . -type d -name '__pycache__' -print0 | xargs -r -0 rm -rf
find . -type d -name '*.dist-info' -print0 | xargs -r -0 rm -rf
find . -type d -name '*.egg-info' -print0 | xargs -r -0 rm -rf