forked from graphprotocol/firehose-cosmos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
43 lines (36 loc) · 1.16 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
PKG ?= github.com/figment-networks/firehose-cosmos
BUILD_COMMIT ?= $(shell git rev-parse HEAD)
BUILD_TIME ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ" | tr -d '\n')
BUILD_PATH ?= firecosmos
LDFLAGS ?= -s -w -X main.BuildCommit=$(BUILD_COMMIT) -X main.BuildTime=$(BUILD_TIME)
VERSION ?= latest
DOCKER_IMAGE ?= figmentnetworks/firehose-cosmos
DOCKER_TAG ?= ${VERSION}
DOCKER_UID ?= 1234
.PHONY: build
build:
go build -o build/firecosmos -ldflags "$(LDFLAGS)" ./cmd/firecosmos/cli
.PHONY: install
install:
go install -ldflags "$(LDFLAGS)" ./cmd/firecosmos/cli
.PHONY: build-all
build-all:
@mkdir -p dist
@rm -f dist/*
LDFLAGS="$(LDFLAGS)" ./scripts/buildall.sh
# MallocNanoZone env var fixes panics in racemode on osx
.PHONY: test
test:
MallocNanoZone=0 go test -race -cover ./...
.PHONY: docker-build
docker-build:
docker build --build-arg=USER_ID=${DOCKER_UID} -t ${DOCKER_IMAGE}:${DOCKER_TAG} .
.PHONY: docker-push
docker-push:
docker push ${DOCKER_IMAGE}:${DOCKER_TAG}
.PHONY: docker-buildall
docker-buildall:
docker buildx build \
--build-arg=USER_ID=${DOCKER_UID} \
--platform linux/amd64,linux/arm64 \
-t ${DOCKER_IMAGE}:${DOCKER_TAG} .