feat: add production build and health tooling
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
APP := chfs-ng
|
||||
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
|
||||
LDFLAGS := -s -w -X main.version=$(VERSION)
|
||||
|
||||
.PHONY: build test race vet check run docker-build docker-run
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 go build -trimpath -ldflags '$(LDFLAGS)' -o bin/$(APP) ./cmd/chfs
|
||||
|
||||
test:
|
||||
go test ./...
|
||||
|
||||
race:
|
||||
go test -race ./...
|
||||
|
||||
vet:
|
||||
go vet ./...
|
||||
|
||||
check: test race vet
|
||||
git diff --check
|
||||
|
||||
run:
|
||||
go run -ldflags '$(LDFLAGS)' ./cmd/chfs
|
||||
|
||||
docker-build:
|
||||
docker build --build-arg VERSION=$(VERSION) -t $(APP):$(VERSION) -t $(APP):latest .
|
||||
|
||||
docker-run:
|
||||
docker run --rm -p 8080:80 -v $(PWD)/data:/data $(APP):latest -path /data -port 80
|
||||
Reference in New Issue
Block a user