add dep management
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
SHELL := /bin/zsh
|
||||
# PLATFORM := $(shell go env GOOS)
|
||||
PLATFORM=linux
|
||||
# ARCH := $(shell go env GOARCH)
|
||||
ARCH := amd64
|
||||
GOPATH := $(shell go env GOPATH)
|
||||
GOBIN := $(GOPATH)/bin
|
||||
TARGET := websocket-proxy
|
||||
# Go related variables.
|
||||
GO_PATH := $(PWD):$(PWD)/vendor:$(GOPATH)
|
||||
VERSION := 0.0.1
|
||||
ifeq (run,$(firstword $(MAKECMDGOALS)))
|
||||
# use the rest as arguments for "run"
|
||||
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
|
||||
# ...and turn them into do-nothing targets
|
||||
# $(eval $(RUN_ARGS):;@:)
|
||||
endif
|
||||
|
||||
all: build docker
|
||||
|
||||
build:
|
||||
@echo ".:: buiding binary for $(PLATFORM) ::."
|
||||
@rm -f $(TARGET)
|
||||
@GOPATH=$(GO_PATH) GOOS=$(PLATFORM) GOARCH=$(ARCH) go build -o $(TARGET) .
|
||||
|
||||
docker:
|
||||
@echo ".:: building docker image ::."
|
||||
@docker build -t kafka-websocket-go:$(VERSION) .
|
||||
|
||||
run:
|
||||
@echo ".:: starting server ::."
|
||||
@echo " bootstrap servers : $(RUN_ARGS)"
|
||||
@go run serv.go -addr :9000 --bootstrap-servers $(RUN_ARGS)
|
||||
Reference in New Issue
Block a user