-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
53 lines (40 loc) · 1.32 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
git=$(subst -,.,$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null))
ldflags=-X=github.com/ipfs-force-community/sophon-messager/version.CurrentCommit=+git.$(git)
ifneq ($(strip $(LDFLAGS)),)
ldflags+=-extldflags=$(LDFLAGS)
endif
GOFLAGS+=-ldflags="$(ldflags)"
build:
rm -rf sophon-messager
go build $(GOFLAGS) -o sophon-messager .
tools:
rm -rf sophon-messager-tools
go build -o sophon-messager-tools ./tools/main.go
.PHONY: tools
gen:
go generate ./...
lint:
golangci-lint run
test:
go test -race ./...
.PHONY: docker
TAG:=test
docker:
ifdef DOCKERFILE
cp $(DOCKERFILE) ./dockerfile
else
curl -O https://raw.githubusercontent.com/filecoin-project/venus-docs/master/script/docker/dockerfile
endif
docker build --build-arg https_proxy=$(BUILD_DOCKER_PROXY) --build-arg BUILD_TARGET=sophon-messager -t sophon-messager .
docker tag sophon-messager filvenus/sophon-messager:$(TAG)
ifdef PRIVATE_REGISTRY
docker tag sophon-messager $(PRIVATE_REGISTRY)/filvenus/sophon-messager:$(TAG)
endif
docker-push: docker
ifdef PRIVATE_REGISTRY
docker push $(PRIVATE_REGISTRY)/filvenus/sophon-messager:$(TAG)
else
docker push filvenus/sophon-messager:$(TAG)
docker tag filvenus/sophon-messager:$(TAG) filvenus/sophon-messager:latest
docker push filvenus/sophon-messager:latest
endif