-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
49 lines (41 loc) · 1.08 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
THIS_FILE := $(lastword $(MAKEFILE_LIST))
.PHONY: build invoke-prod invoke-dev deploy test update cleanup
build:
pipenv lock -r > requirements.txt
sam build --manifest requirements.txt
rm requirements.txt
invoke-prod:
@$(MAKE) -f $(THIS_FILE) check-env
@$(MAKE) -f $(THIS_FILE) build
sam local invoke --parameter-overrides \
Dev=false \
EmailFrom=${EMAIL_FROM} \
EmailTo=${EMAIL_TO}
invoke-dev:
@$(MAKE) -f $(THIS_FILE) check-env
@$(MAKE) -f $(THIS_FILE) build
sam local invoke --parameter-overrides \
Dev=true \
EmailFrom=${EMAIL_FROM} \
EmailTo=${EMAIL_TO}
deploy:
@$(MAKE) -f $(THIS_FILE) check-env
@$(MAKE) -f $(THIS_FILE) build
sam deploy --stack-name in-stock-notifier \
--guided \
--parameter-overrides \
Dev=false \
EmailFrom=${EMAIL_FROM} \
EmailTo=${EMAIL_TO}
test:
pytest in_stock_notifier
cleanup:
aws cloudformation delete-stack --stack-name in-stock-notifier
aws dynamodb delete-table --table-name in-stock-notifications
check-env:
ifndef EMAIL_FROM
$(error EMAIL_FROM envvar is undefined)
endif
ifndef EMAIL_TO
$(error EMAIL_TO envvar is undefined)
endif