Permalink
Find file Copy path
e797344 Jul 2, 2018
1 contributor

Users who have contributed to this file

41 lines (31 sloc) 845 Bytes
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