-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (35 loc) · 1.19 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
GOPATH ?= $(shell go env GOPATH)
export GO111MODULE=on
########################################
### Build
build:
go build -ldflags "-extldflags \"-static\"" -o build/aws-lambda-go-template .
build-linux:
GOOS=linux GOARCH=amd64 $(MAKE) build
########################################
### Testing
test:
go test -cover -race ./...
########################################
### Linting
$(GOPATH)/bin/golangci-lint:
GO111MODULE=off go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
lint: $(GOPATH)/bin/golangci-lint
$(GOPATH)/bin/golangci-lint run ./...
########################################
### Localnet
localnet-start:
build/aws-lambda-go-template -webserver
localnet-lambda:
# (Requirements: pip3 install aws-sam-cli)
sam local start-api
########################################
### Deploy
# Make sure your AWS credentials are in place.
deploy:
file build/aws-lambda-go-template | grep ELF || (echo "Please build a linux binary." && false)
zip build/mylambda.zip build/aws-lambda-go-template
cd terraform && terraform init && terraform apply --auto-approve
destroy:
cd terraform && terraform destroy
.PHONY: build build-linux test localnet-start localnet-lambda deploy destroy