-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from vearne/dev
update Makefile
- Loading branch information
Showing
2 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM golang:1.18.5 | ||
|
||
RUN apt-get update && apt-get install vim-common libpcap-dev -y | ||
|
||
|
||
WORKDIR /go/src/github.com/vearne/grpcreplay/ | ||
ADD . /go/src/github.com/vearne/grpcreplay/ | ||
|
||
# install dependencies | ||
RUN go get |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,38 @@ | ||
VERSION := v0.0.1 | ||
|
||
BIN_NAME = grpcr | ||
CONTAINER=grpcr | ||
CONTAINER = grpcr | ||
IMPORT_PATH = github.com/vearne/grpcreplay | ||
|
||
BUILD_TIME = $(shell date +%Y%m%d%H%M%S) | ||
GITTAG = `git log -1 --pretty=format:"%H"` | ||
LDFLAGS = -ldflags "-s -w -X $(IMPORT_PATH)/consts.GitTag=${GITTAG} -X $(IMPORT_PATH)/consts.BuildTime=${BUILD_TIME} -X $(IMPORT_PATH)/consts.Version=${VERSION}" | ||
SOURCE_PATH = /go/src/github.com/vearne/grpcreplay/ | ||
|
||
.PHONY: build install release release-linux release-mac docker-img | ||
.PHONY: build install release release-linux-arm64 release-mac-arm64 docker-img | ||
|
||
|
||
build: | ||
go build $(LDFLAGS) -o $(BIN_NAME) | ||
go build $(LDFLAGS) -o $(BIN_NAME) | ||
|
||
#release: release-linux-amd64 release-mac-arm64 | ||
|
||
release-linux-amd64: | ||
docker run -v `pwd`:$(SOURCE_PATH) -it -e GOOS=linux -e GOARCH=amd64 $(CONTAINER) go build $(LDFLAGS) -o $(BIN_NAME) | ||
tar -zcvf $(BIN_NAME)-$(VERSION)-linux-amd64.tar.gz ./$(BIN_NAME) | ||
rm $(BIN_NAME) | ||
|
||
release-mac-arm64: | ||
env GOOS=darwin GOARCH=arm64 go build $(LDFLAGS) -o $(BIN_NAME) | ||
tar -zcvf $(BIN_NAME)-$(VERSION)-darwin-arm64.tar.gz ./$(BIN_NAME) | ||
rm $(BIN_NAME) | ||
|
||
docker-img: | ||
docker build --rm -t $(CONTAINER) -f Dockerfile.dev . | ||
|
||
clean: | ||
rm -rf *.pkg | ||
rm -rf *.zip | ||
rm -rf *.gz | ||
rm -rf *.deb | ||
rm -rf *.rpm |