2020-05-10 00:02:18 +02:00
|
|
|
PACKAGE_NAME=hugo-mx-gateway
|
|
|
|
PRODUCT_VERSION=$$(grep "ProgramVersion.=.*" main.go | cut -d"\"" -f2)-$$(git rev-parse --short HEAD)
|
|
|
|
PRODUCT_CLOUD_IMAGE_VERSION=$$(echo $(PRODUCT_VERSION) | sed 's/\.//g' -)
|
|
|
|
ARCH=$$(uname -m)
|
|
|
|
DIST_DIR=$(PACKAGE_NAME)-v$(PRODUCT_VERSION)-$(ARCH)
|
|
|
|
GOCMD=GO111MODULE=off go
|
|
|
|
GOBUILD=$(GOCMD) build
|
|
|
|
GOCLEAN=$(GOCMD) clean
|
|
|
|
GOTEST=$(GOCMD) test
|
|
|
|
GOGET=$(GOCMD) get -v
|
|
|
|
GOVENDOR=govendor
|
|
|
|
UPX=upx
|
|
|
|
PACKER=packer
|
|
|
|
PACKER_VERSION=1.5.1
|
|
|
|
PACKER_CONF_FILE="./deploy/packer/cloud-image.json"
|
|
|
|
|
|
|
|
all: test build
|
|
|
|
|
2020-05-10 01:20:35 +02:00
|
|
|
deploy:
|
|
|
|
which gcloud
|
|
|
|
gcloud components install app-engine-go
|
2020-05-14 14:58:22 +02:00
|
|
|
gcloud app deploy --quiet
|
2020-05-10 01:20:35 +02:00
|
|
|
|
2020-05-10 00:02:18 +02:00
|
|
|
build:
|
|
|
|
$(GOBUILD) -o $(PACKAGE_NAME) -v
|
|
|
|
|
|
|
|
build-compress: build
|
|
|
|
$(UPX) $(PACKAGE_NAME)
|
|
|
|
|
|
|
|
test:
|
|
|
|
$(GOCMD) clean -testcache
|
|
|
|
$(GOTEST) -v ./...
|
|
|
|
|
|
|
|
clean:
|
|
|
|
$(GOCLEAN)
|
|
|
|
rm -f $(PACKAGE_NAME)
|
|
|
|
|
|
|
|
run:
|
|
|
|
$(GOBUILD) -o $(PACKAGE_NAME) -v ./...
|
|
|
|
./$(PACKAGE_NAME)
|
|
|
|
|
|
|
|
deps: vendor
|
|
|
|
|
|
|
|
vendor:
|
2020-05-10 01:20:35 +02:00
|
|
|
$(GO) mod vendor
|
2020-05-10 00:02:18 +02:00
|
|
|
|
|
|
|
docker-build:
|
|
|
|
docker run --rm -it -v "$(GOPATH)":/go -w /go/src/bitbucket.org/rsohlich/makepost golang:latest go build -o "$(BINARY_UNIX)" -v
|