-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase.mk
49 lines (40 loc) · 1.42 KB
/
base.mk
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
.DEFAULT_GOAL := help
DEPLOY_REGION = us-east-1
USERNAME_LOCAL = "$(shell whoami)"
HASH = $$(date +%s)
hash:
echo $(HASH)
create_stack: ## Deploy stack on AWS: make deploy
@echo starting deployment
@aws cloudformation deploy \
--template-file $(CLOUDFORMATION_TEMPLATE) \
--stack-name ${STACK_NAME} \
--parameter-overrides $(PARAMETERS) \
--region ${DEPLOY_REGION} \
--capabilities CAPABILITY_NAMED_IAM
@echo deployment completed
#@make sync-bucket
remove_stack:
@echo starting stack delete
@aws cloudformation delete-stack \
--stack-name $(STACK_NAME) \
--region ${DEPLOY_REGION}
events: ## Show stack events: make events
@aws cloudformation describe-stack-events \
--stack-name $(PROJECT_NAME) \
--region ${DEPLOY_REGION}
delete-stack:
@echo starting stack delete
@aws cloudformation delete-stack \
--stack-name $(PROJECT_NAME) \
--region ${DEPLOY_REGION}
delete-bucket:
@echo starting bucket delete
@aws s3 rb s3://$(BUCKET_NAME) --force
sync-bucket: ## Sync data with the bucket: make sync-bucket
@echo starting sync bucket
@aws s3 sync ./public s3://$(BUCKET_NAME) --acl public-read
help:
@printf "\033[31m%-22s %-59s %s\033[0m\n" "Target" " Help" "Usage"; \
printf "\033[31m%-22s %-59s %s\033[0m\n" "------" " ----" "-----"; \
grep -hE '^\S+:.*## .*$$' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' | sort | awk 'BEGIN {FS = ":"}; {printf "\033[32m%-22s\033[0m %-58s \033[34m%s\033[0m\n", $$1, $$2, $$3}'