-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
63 lines (49 loc) · 1.4 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
PROJECT_NAME ?= appsync-resolvers-example
ENV ?= stable
AWS_BUCKET_NAME ?= $(PROJECT_NAME)-artifacts-$(ENV)
AWS_STACK_NAME ?= $(PROJECT_NAME)-stack-$(ENV)
AWS_REGION ?= eu-west-1
GOOS ?= linux
FILE_TEMPLATE = template.yml
FILE_PACKAGE = package.yml
EXPIRATION = $(shell echo $$(( $(shell date +%s) + 604800 ))) # 7 days from now (timestamp)
clean:
rm -rf dist
install:
@ dep ensure
test:
@ go test ./... -v
build:
@ GOOS=$(GOOS) go build -o dist/handler_$(GOOS) ./src
build-osx:
@ GOOS=darwin make build
configure:
@ aws s3api create-bucket \
--bucket $(AWS_BUCKET_NAME) \
--region $(AWS_REGION) \
--create-bucket-configuration LocationConstraint=$(AWS_REGION)
package:
@ aws cloudformation package \
--template-file $(FILE_TEMPLATE) \
--s3-bucket $(AWS_BUCKET_NAME) \
--region $(AWS_REGION) \
--output-template-file $(FILE_PACKAGE)
deploy:
@ aws cloudformation deploy \
--template-file $(FILE_PACKAGE) \
--region $(AWS_REGION) \
--capabilities CAPABILITY_IAM \
--stack-name $(AWS_STACK_NAME) \
--force-upload \
--parameter-overrides \
ParamProjectName=$(PROJECT_NAME) \
ParamKeyExpiration=$(EXPIRATION) \
ParamENV=$(ENV)
describe:
@ aws cloudformation describe-stacks \
--region $(AWS_REGION) \
--stack-name $(AWS_STACK_NAME)
outputs:
@ make describe \
| jq -r '.Stacks[0].Outputs'
.PHONY: clean install build build-lambda configure package deploy describe output