53 lines
1.1 KiB
Makefile
53 lines
1.1 KiB
Makefile
VERSION=$(shell git describe --tags --abbrev=0)
|
|
BUILD=$(shell git rev-parse --short HEAD)
|
|
PROJ := $(shell basename "$(PWD)")
|
|
HUB=hub.kumoly.io
|
|
HUB_PROJECT=tools
|
|
|
|
LDFLAGS=-ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD} -w"
|
|
PLATFORMS=darwin linux
|
|
ARCHITECTURES=amd64
|
|
APPS=configui
|
|
|
|
default: build
|
|
|
|
install:
|
|
npm install
|
|
|
|
clean:
|
|
rm -rf dist
|
|
|
|
run: build
|
|
$(shell cd dist; ./${PROJ} -log configui.log)
|
|
|
|
.PHONY: web
|
|
web:
|
|
npm run build
|
|
# npm run js-dev
|
|
|
|
.PHONY: build
|
|
build:
|
|
go build ${LDFLAGS} -o dist/${PROJ} cmd/$(PROJ)/main.go
|
|
|
|
.PHONY: binary
|
|
binary:
|
|
bash release.sh cmd/configui/main.go
|
|
|
|
.PHONY: docker
|
|
docker:
|
|
docker build --target builder -t $(HUB)/$(HUB_PROJECT)/$(PROJ):builder .
|
|
docker build \
|
|
-t $(HUB)/$(HUB_PROJECT)/$(PROJ):$(VERSION) \
|
|
.
|
|
|
|
docker-push:
|
|
docker tag $(HUB)/$(HUB_PROJECT)/$(PROJ):$(VERSION) $(HUB)/$(HUB_PROJECT)/$(PROJ):latest
|
|
docker push $(HUB)/$(HUB_PROJECT)/$(PROJ):$(VERSION)
|
|
docker push $(HUB)/$(HUB_PROJECT)/$(PROJ):latest
|
|
|
|
docker-save:
|
|
docker save $(HUB)/$(HUB_PROJECT)/$(PROJ):$(VERSION) | gzip > dist/$(PROJ)-image-$(VERSION)-${BUILD}.tar.gz
|
|
|
|
|
|
.PHONY: release
|
|
release: clean web binary docker docker-save |