Add MCR and VERSION variables. Tag images with full MCR registry URL and version. Add push target that builds then pushes to MCR. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
46 lines
1.0 KiB
Makefile
46 lines
1.0 KiB
Makefile
.PHONY: build test vet lint proto proto-lint clean docker push all devserver
|
|
|
|
MCR := mcr.svc.mcp.metacircular.net:8443
|
|
VERSION := $(shell git describe --tags --always --dirty)
|
|
LDFLAGS := -trimpath -ldflags="-s -w -X main.version=$(VERSION)"
|
|
|
|
mcns:
|
|
CGO_ENABLED=0 go build $(LDFLAGS) -o mcns ./cmd/mcns
|
|
|
|
build:
|
|
go build ./...
|
|
|
|
test:
|
|
go test ./...
|
|
|
|
vet:
|
|
go vet ./...
|
|
|
|
lint:
|
|
golangci-lint run ./...
|
|
|
|
proto:
|
|
protoc --go_out=. --go_opt=module=git.wntrmute.dev/mc/mcns \
|
|
--go-grpc_out=. --go-grpc_opt=module=git.wntrmute.dev/mc/mcns \
|
|
proto/mcns/v1/*.proto
|
|
|
|
proto-lint:
|
|
buf lint
|
|
buf breaking --against '.git#branch=master,subdir=proto'
|
|
|
|
clean:
|
|
rm -f mcns
|
|
|
|
docker:
|
|
docker build --build-arg VERSION=$(VERSION) -t $(MCR)/mcns:$(VERSION) -f Dockerfile .
|
|
|
|
push: docker
|
|
docker push $(MCR)/mcns:$(VERSION)
|
|
|
|
devserver: mcns
|
|
@mkdir -p srv
|
|
@if [ ! -f srv/mcns.toml ]; then cp deploy/examples/mcns.toml srv/mcns.toml; echo "Created srv/mcns.toml from example — edit before running."; fi
|
|
./mcns server --config srv/mcns.toml
|
|
|
|
all: vet lint test mcns
|