-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
40 lines (31 loc) · 845 Bytes
/
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
OUTPUT = main # Referenced as Handler in template.yaml
PACKAGED_TEMPLATE = packaged.yaml
S3_BUCKET := $(S3_BUCKET)
STACK_NAME := $(STACK_NAME)
TEMPLATE = template.yaml
.PHONY: test
test:
go test ./...
.PHONY: clean
clean:
rm -f $(OUTPUT) $(PACKAGED_TEMPLATE)
.PHONY: install
install:
go get ./...
main: ./function/main.go
go build -o $(OUTPUT) ./function/main.go
# compile the code to run in Lambda (local or real)
.PHONY: lambda
lambda:
GOOS=linux GOARCH=amd64 $(MAKE) main
.PHONY: build
build: clean lambda
.PHONY: api
api: build
sam local start-api
.PHONY: package
package: build
sam package --template-file $(TEMPLATE) --s3-bucket $(S3_BUCKET) --output-template-file $(PACKAGED_TEMPLATE)
.PHONY: deploy
deploy: package
sam deploy --stack-name $(STACK_NAME) --template-file $(PACKAGED_TEMPLATE) --capabilities CAPABILITY_IAM