-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (48 loc) · 1.43 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
AWS_REGION ?= eu-central-1
S3_BUCKET ?= najnowsze-xyz-deployment
STACK_NAME ?= najnowszexyz
install:
-rm -rf vendor/
@bundle install --no-deployment --with test
install-deployment:
@docker run -v `pwd`:`pwd` -w `pwd` -i -t lambci/lambda:build-ruby2.7 \
bundle install --deployment --without test development
test:
@bundle exec rspec spec
create-s3-bucket:
if ! aws s3api head-bucket --bucket $(S3_BUCKET) --region $(AWS_REGION) 2>/dev/null; then \
aws s3 mb s3://$(S3_BUCKET) --region $(AWS_REGION) \
; \
fi
sam-package:
@sam package \
--template-file template.yaml \
--output-template-file packaged.yaml \
--s3-bucket $(S3_BUCKET) \
--region $(AWS_REGION)
sam-deploy:
@sam deploy \
--template-file packaged.yaml \
--capabilities CAPABILITY_IAM \
--stack-name $(STACK_NAME) \
--region $(AWS_REGION)
deploy: install-deployment create-s3-bucket sam-package sam-deploy
destroy:
@aws cloudformation delete-stack --stack-name $(STACK_NAME)
start-local-dynamodb:
@docker run -d -p 8000:8000 amazon/dynamodb-local
validate-template:
@aws cloudformation validate-template \
--template-body file://template.yaml
describe:
@aws cloudformation describe-stacks \
--region $(AWS_REGION) \
--stack-name $(STACK_NAME) \
outputs:
@aws cloudformation describe-stacks \
--region $(AWS_REGION) \
--stack-name $(STACK_NAME) \
--query 'Stacks[].Outputs'
run:
@sam local start-api --env-vars env.json
.PHONY: test