Skip to content
This repository was archived by the owner on Mar 6, 2022. It is now read-only.

Commit b36df9e

Browse files
committed
update makefile: add docker build, rename targets for lambda function and server builds, remove a few things
1 parent 47329a1 commit b36df9e

File tree

1 file changed

+22
-38
lines changed

1 file changed

+22
-38
lines changed

Makefile

Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,23 @@ ARCH := amd64
66
PACKAGE := github.com/dan-v/$(TARGET)
77

88
.PHONY: \
9-
help \
109
clean \
11-
clean-artifacts \
1210
tools \
1311
test \
1412
coverage \
1513
vet \
1614
lint \
1715
fmt \
1816
build \
19-
build-lambda \
20-
build-server \
17+
lambda-build \
18+
server-build-linux \
19+
server-build-osx \
2120
doc \
22-
version \
23-
release
24-
25-
all: tools fmt lint vet build release
26-
27-
help:
28-
@echo 'Usage: make <OPTIONS> ... <TARGETS>'
29-
@echo ''
30-
@echo 'Available targets are:'
31-
@echo ''
32-
@echo ' help Show this help screen.'
33-
@echo ' clean Remove binaries, artifacts and releases.'
34-
@echo ' tools Install tools needed by the project.'
35-
@echo ' test Run unit tests.'
36-
@echo ' coverage Report code tests coverage.'
37-
@echo ' vet Run go vet.'
38-
@echo ' lint Run golint.'
39-
@echo ' fmt Run go fmt.'
40-
@echo ' build Build all.'
41-
@echo ' build-lambda Build lambda function.'
42-
@echo ' build-server Build server.'
43-
@echo ' release Zip up final artifact'
44-
@echo ' doc Start Go documentation server on port 8080.'
45-
@echo ' version Display Go version.'
46-
@echo ''
21+
release \
22+
docker-build \
23+
docker-release \
24+
25+
all: tools fmt lint vet test build release
4726

4827
print-%:
4928
@echo $* = $($*)
@@ -79,31 +58,36 @@ lint:
7958
fmt:
8059
go fmt ./...
8160

82-
build-lambda:
61+
lambda-build:
8362
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o artifacts/lambda/main ./pkg/lambda
8463
zip -jr artifacts/lambda artifacts/lambda
8564
go-bindata -nocompress -pkg server -o pkg/server/bindata.go artifacts/lambda.zip
65+
mv artifacts/lambda.zip artifacts/lambda-$(VERSION).zip
8666

87-
build-server:
67+
server-build-linux:
8868
CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -ldflags \
8969
"-X $(PACKAGE)/cmd/awslambdaproxy.version=$(VERSION)" \
9070
-v -o $(CURDIR)/artifacts/server/$(OS)/$(TARGET) ./cmd/main.go
9171

92-
build-server-osx:
72+
server-build-osx:
9373
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags \
9474
"-X $(PACKAGE)/cmd/awslambdaproxy.version=$(VERSION)" \
9575
-v -o $(CURDIR)/artifacts/server/darwin/$(TARGET) ./cmd/main.go
9676

97-
build: build-lambda build-server
77+
build: lambda-build server-build-linux
9878

99-
build-osx: build-lambda build-server-osx
79+
build-osx: lambda-build server-build-osx
10080

10181
doc:
10282
godoc -http=:8080 -index
10383

104-
version:
105-
@go version
106-
10784
release:
10885
mkdir -p ./artifacts
109-
zip -jr ./artifacts/$(TARGET)-$(OS)-$(VERSION).zip ./artifacts/server/$(OS)/$(TARGET)
86+
zip -jr ./artifacts/$(TARGET)-$(OS)-$(VERSION).zip ./artifacts/server/$(OS)/$(TARGET)
87+
88+
docker:
89+
docker build . -t vdan/awslambdaproxy:$(VERSION) -t vdan/awslambdaproxy:latest
90+
91+
docker-release:
92+
docker push vdan/awslambdaproxy:$(VERSION)
93+
docker push vdan/awslambdaproxy:latest

0 commit comments

Comments
 (0)