updated CI targets supporting docker build
This commit is contained in:
parent
226cb30961
commit
d424577ce5
40
Makefile
40
Makefile
|
@ -1,29 +1,31 @@
|
||||||
PACKAGE_NAME=hugo-mx-gateway
|
PACKAGE_NAME=./bin/hugo-mx-gateway
|
||||||
PRODUCT_VERSION=$$(grep "ProgramVersion.=.*" main.go | cut -d"\"" -f2)-$$(git rev-parse --short HEAD)
|
DOCKER_IMAGE=rchakode/hugo-mx-gateway
|
||||||
PRODUCT_CLOUD_IMAGE_VERSION=$$(echo $(PRODUCT_VERSION) | sed 's/\.//g' -)
|
|
||||||
ARCH=$$(uname -m)
|
ARCH=$$(uname -m)
|
||||||
DIST_DIR=$(PACKAGE_NAME)-v$(PRODUCT_VERSION)-$(ARCH)
|
GOCMD=GO111MODULE=on go
|
||||||
GOCMD=GO111MODULE=off go
|
|
||||||
GOBUILD=$(GOCMD) build
|
GOBUILD=$(GOCMD) build
|
||||||
GOCLEAN=$(GOCMD) clean
|
GOCLEAN=$(GOCMD) clean
|
||||||
GOTEST=$(GOCMD) test
|
GOTEST=$(GOCMD) test
|
||||||
GOGET=$(GOCMD) get -v
|
GOVENDOR=$(GOCMD) mod vendor
|
||||||
GOVENDOR=govendor
|
GOIMAGE=golang:1.13.10
|
||||||
UPX=upx
|
UPX=upx
|
||||||
PACKER=packer
|
|
||||||
PACKER_VERSION=1.5.1
|
|
||||||
PACKER_CONF_FILE="./deploy/packer/cloud-image.json"
|
|
||||||
|
|
||||||
all: test build
|
all: test build
|
||||||
|
|
||||||
deploy:
|
|
||||||
which gcloud
|
|
||||||
gcloud components install app-engine-go
|
|
||||||
gcloud app deploy --quiet
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
$(GOBUILD) -o $(PACKAGE_NAME) -v
|
$(GOBUILD) -o $(PACKAGE_NAME) -v
|
||||||
|
|
||||||
|
build-docker:
|
||||||
|
docker run --rm -it \
|
||||||
|
-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
|
||||||
|
docker build -t $(DOCKER_IMAGE):$$(date +%s) .
|
||||||
|
|
||||||
build-compress: build
|
build-compress: build
|
||||||
$(UPX) $(PACKAGE_NAME)
|
$(UPX) $(PACKAGE_NAME)
|
||||||
|
|
||||||
|
@ -37,12 +39,8 @@ clean:
|
||||||
|
|
||||||
run:
|
run:
|
||||||
$(GOBUILD) -o $(PACKAGE_NAME) -v ./...
|
$(GOBUILD) -o $(PACKAGE_NAME) -v ./...
|
||||||
./$(PACKAGE_NAME)
|
$(PACKAGE_NAME)
|
||||||
|
|
||||||
deps: vendor
|
deps: vendor
|
||||||
|
|
||||||
vendor:
|
vendor:
|
||||||
$(GO) mod vendor
|
$(GOVENDOR)
|
||||||
|
|
||||||
docker-build:
|
|
||||||
docker run --rm -it -v "$(GOPATH)":/go -w /go/src/bitbucket.org/rsohlich/makepost golang:latest go build -o "$(BINARY_UNIX)" -v
|
|
Loading…
Reference in New Issue