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