hugo-mx-gateway/Makefile

54 lines
1.0 KiB
Makefile
Raw Normal View History

PACKAGE_NAME=./bin/hugo-mx-gateway
DOCKER_IMAGE_REPO=rchakode/hugo-mx-gateway
2020-05-10 00:02:18 +02:00
ARCH=$$(uname -m)
GOCMD=GO111MODULE=on go
2020-05-10 00:02:18 +02:00
GOBUILD=$(GOCMD) build
GOBUILD_FLAGS=-a -tags netgo -ldflags '-w -extldflags "-static"'
2020-05-10 00:02:18 +02:00
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOVENDOR=$(GOCMD) mod vendor
GOIMAGE=golang:1.13.10
2020-05-10 00:02:18 +02:00
UPX=upx
2020-05-17 21:53:35 +02:00
all: deps test build
2020-05-10 00:02:18 +02:00
2020-05-17 21:53:35 +02:00
deps: vendor
vendor:
$(GOVENDOR)
2020-05-10 00:02:18 +02:00
build:
$(GOBUILD) $(GOBUILD_FLAGS) -o $(PACKAGE_NAME) -v
2020-05-10 00:02:18 +02:00
build-ci:
2020-05-31 16:07:00 +02:00
docker run --rm \
-e GO111MODULE=on \
-e CGO_ENABLED=0 \
-e GOOS=linux \
-e GOARCH=amd64 \
-v "$(PWD)":/app \
-w /app \
$(GOIMAGE) \
go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o "$(PACKAGE_NAME)" -v
container: build-ci
docker build -t $(DOCKER_IMAGE_REPO):$$(date +%s) .
2020-05-10 00:02:18 +02:00
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)
2020-05-10 00:02:18 +02:00
2020-05-17 21:53:35 +02:00
deploy-gcp:
which gcloud
gcloud components install app-engine-go
gcloud app deploy --quiet