Add MCR and VERSION variables. Tag images with full MCR registry URL and version. Add push target. Fix docker target to build both Dockerfile.api and Dockerfile.web (was only building one). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
54 lines
1.3 KiB
Makefile
54 lines
1.3 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)"
|
|
|
|
mcrsrv:
|
|
CGO_ENABLED=0 go build $(LDFLAGS) -o mcrsrv ./cmd/mcrsrv
|
|
|
|
mcr-web:
|
|
CGO_ENABLED=0 go build $(LDFLAGS) -o mcr-web ./cmd/mcr-web
|
|
|
|
mcrctl:
|
|
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o mcrctl ./cmd/mcrctl
|
|
|
|
build:
|
|
go build ./...
|
|
|
|
test:
|
|
go test ./...
|
|
|
|
vet:
|
|
go vet ./...
|
|
|
|
lint:
|
|
golangci-lint run ./...
|
|
|
|
proto:
|
|
protoc --go_out=. --go_opt=module=git.wntrmute.dev/mc/mcr \
|
|
--go-grpc_out=. --go-grpc_opt=module=git.wntrmute.dev/mc/mcr \
|
|
proto/mcr/v1/*.proto
|
|
|
|
proto-lint:
|
|
buf lint
|
|
buf breaking --against '.git#branch=master,subdir=proto'
|
|
|
|
clean:
|
|
rm -f mcrsrv mcr-web mcrctl
|
|
|
|
docker:
|
|
docker build --build-arg VERSION=$(VERSION) -t $(MCR)/mcr:$(VERSION) -f Dockerfile.api .
|
|
docker build --build-arg VERSION=$(VERSION) -t $(MCR)/mcr-web:$(VERSION) -f Dockerfile.web .
|
|
|
|
push: docker
|
|
docker push $(MCR)/mcr:$(VERSION)
|
|
docker push $(MCR)/mcr-web:$(VERSION)
|
|
|
|
devserver: mcrsrv
|
|
@mkdir -p srv
|
|
@if [ ! -f srv/mcr.toml ]; then cp deploy/examples/mcr.toml srv/mcr.toml; echo "Created srv/mcr.toml from example — edit before running."; fi
|
|
./mcrsrv server --config srv/mcr.toml
|
|
|
|
all: vet lint test mcrsrv mcr-web mcrctl
|