2018-02-01 18:54:23 +00:00
|
|
|
BRANCH = "master"
|
2018-04-16 08:41:23 +00:00
|
|
|
REPONAME = "neo-go"
|
2018-03-15 20:45:37 +00:00
|
|
|
NETMODE ?= "privnet"
|
2019-08-28 19:05:55 +00:00
|
|
|
BINARY = "./bin/neo-go"
|
2018-02-01 18:54:23 +00:00
|
|
|
|
2019-08-26 14:26:42 +00:00
|
|
|
REPO ?= "$(shell go list -m)"
|
2019-08-26 14:05:17 +00:00
|
|
|
VERSION ?= "$(shell git describe --tags 2>/dev/null | sed 's/^v//')"
|
2019-08-28 19:09:36 +00:00
|
|
|
BUILD_FLAGS = "-X $(REPO)/config.Version=$(VERSION)"
|
2019-08-26 14:05:17 +00:00
|
|
|
|
2019-08-26 14:26:42 +00:00
|
|
|
build: deps
|
|
|
|
@echo "=> Building binary"
|
|
|
|
@set -x \
|
|
|
|
&& export GOGC=off \
|
|
|
|
&& export CGO_ENABLED=0 \
|
2019-08-28 19:05:55 +00:00
|
|
|
&& go build -v -mod=vendor -ldflags $(BUILD_FLAGS) -o ${BINARY} ./cli/main.go
|
2018-02-01 18:06:17 +00:00
|
|
|
|
2019-08-26 14:26:42 +00:00
|
|
|
image: deps
|
|
|
|
@echo "=> Building image"
|
|
|
|
@docker build -t cityofzion/neo-go:latest --build-arg REPO=$(REPO) --build-arg VERSION=$(VERSION) .
|
|
|
|
@docker build -t cityofzion/neo-go:$(VERSION) --build-arg REPO=$(REPO) --build-arg VERSION=$(VERSION) .
|
2018-04-28 18:20:27 +00:00
|
|
|
|
2018-02-01 18:54:23 +00:00
|
|
|
check-version:
|
|
|
|
git fetch && (! git rev-list ${VERSION})
|
|
|
|
|
2018-04-28 18:20:27 +00:00
|
|
|
clean-cluster:
|
|
|
|
@echo "=> Removing all containers and chain storage"
|
|
|
|
@rm -rf chains/privnet-docker-one chains/privnet-docker-two chains/privnet-docker-three chains/privnet-docker-four
|
|
|
|
@docker-compose stop
|
|
|
|
@docker-compose rm -f
|
|
|
|
|
2018-02-01 18:06:17 +00:00
|
|
|
deps:
|
2019-08-26 14:26:42 +00:00
|
|
|
@go mod tidy -v
|
|
|
|
@go mod vendor
|
2018-02-01 18:06:17 +00:00
|
|
|
|
2018-02-01 18:54:23 +00:00
|
|
|
push-tag:
|
|
|
|
git checkout ${BRANCH}
|
|
|
|
git pull origin ${BRANCH}
|
|
|
|
git tag ${VERSION}
|
2018-03-15 20:45:37 +00:00
|
|
|
git push origin ${VERSION}
|
2018-02-01 18:54:23 +00:00
|
|
|
|
2018-04-16 08:41:23 +00:00
|
|
|
push-to-registry:
|
|
|
|
@docker login -e ${DOCKER_EMAIL} -u ${DOCKER_USER} -p ${DOCKER_PASS}
|
|
|
|
@docker tag CityOfZion/${REPONAME}:latest CityOfZion/${REPONAME}:${CIRCLE_TAG}
|
|
|
|
@docker push CityOfZion/${REPONAME}:${CIRCLE_TAG}
|
|
|
|
@docker push CityOfZion/${REPONAME}
|
|
|
|
|
2018-03-03 07:16:05 +00:00
|
|
|
run: build
|
2019-08-28 19:05:55 +00:00
|
|
|
${BINARY} node -config-path ./config -${NETMODE}
|
2018-03-03 07:16:05 +00:00
|
|
|
|
2018-04-28 18:20:27 +00:00
|
|
|
run-cluster: build-linux
|
|
|
|
@echo "=> Starting docker-compose cluster"
|
|
|
|
@echo "=> Building container image"
|
|
|
|
@docker-compose build
|
|
|
|
@docker-compose up -d
|
|
|
|
@echo "=> Tailing logs, exiting this prompt will not stop the cluster"
|
|
|
|
@docker-compose logs -f
|
|
|
|
|
2018-02-01 17:40:04 +00:00
|
|
|
test:
|
2018-02-24 07:23:02 +00:00
|
|
|
@go test ./... -cover
|
2018-02-01 18:54:23 +00:00
|
|
|
|
|
|
|
vet:
|
2018-03-03 07:16:05 +00:00
|
|
|
@go vet ./...
|