Add MCR and VERSION variables. Tag images with full MCR registry URL and version. Add push target. Pass --build-arg VERSION for both images. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
58 lines
1.6 KiB
Makefile
58 lines
1.6 KiB
Makefile
.PHONY: build test vet lint proto-lint clean docker push all devserver metacrypt metacrypt-web proto binaries
|
|
|
|
MCR := mcr.svc.mcp.metacircular.net:8443
|
|
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
|
|
LDFLAGS := -trimpath -ldflags="-s -w -X main.version=$(VERSION)"
|
|
|
|
binaries: metacrypt metacrypt-web
|
|
|
|
proto:
|
|
protoc --go_out=. --go_opt=module=git.wntrmute.dev/mc/metacrypt \
|
|
--go-grpc_out=. --go-grpc_opt=module=git.wntrmute.dev/mc/metacrypt \
|
|
proto/metacrypt/v1/*.proto
|
|
protoc --go_out=. --go_opt=module=git.wntrmute.dev/mc/metacrypt \
|
|
--go-grpc_out=. --go-grpc_opt=module=git.wntrmute.dev/mc/metacrypt \
|
|
proto/metacrypt/v2/*.proto
|
|
|
|
metacrypt:
|
|
go build $(LDFLAGS) -o metacrypt ./cmd/metacrypt
|
|
|
|
metacrypt-web:
|
|
go build $(LDFLAGS) -o metacrypt-web ./cmd/metacrypt-web
|
|
|
|
build:
|
|
go build ./...
|
|
|
|
test:
|
|
go test ./...
|
|
|
|
vet:
|
|
go vet ./...
|
|
|
|
lint:
|
|
golangci-lint run ./...
|
|
|
|
proto-lint:
|
|
buf lint
|
|
buf breaking --against '.git#branch=master,subdir=proto'
|
|
|
|
clean:
|
|
rm -f metacrypt metacrypt-web
|
|
|
|
docker:
|
|
docker build --build-arg VERSION=$(VERSION) -t $(MCR)/metacrypt:$(VERSION) -f Dockerfile.api .
|
|
docker build --build-arg VERSION=$(VERSION) -t $(MCR)/metacrypt-web:$(VERSION) -f Dockerfile.web .
|
|
|
|
push: docker
|
|
docker push $(MCR)/metacrypt:$(VERSION)
|
|
docker push $(MCR)/metacrypt-web:$(VERSION)
|
|
|
|
docker-compose:
|
|
docker compose -f deploy/docker/docker-compose.yml up --build
|
|
|
|
devserver: metacrypt metacrypt-web
|
|
./metacrypt server --config srv/metacrypt.toml &
|
|
./metacrypt-web --config srv/metacrypt.toml
|
|
|
|
all: vet lint test metacrypt metacrypt-web
|