Skip to content

Commit b49a128

Browse files
authored
Build profilecli and pyroscope separately (#3496)
1 parent e19b112 commit b49a128

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

Makefile

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,15 @@ build: frontend/build go/bin ## Do a production build (requiring the frontend bu
7777
build-dev: ## Do a dev build (without requiring the frontend)
7878
$(MAKE) EMBEDASSETS="" go/bin
7979

80-
8180
.PHONY: frontend/build
8281
frontend/build:
83-
docker build -f cmd/pyroscope/frontend.Dockerfile --output=public/build .
82+
docker build -f cmd/pyroscope/frontend.Dockerfile --output=public/build .
83+
84+
.PHONY: profilecli/build
85+
profilecli/build: go/bin-profilecli ## Build the profilecli binary
86+
87+
.PHONY: pyroscope/build
88+
pyroscope/build: go/bin-pyroscope ## Build just the pyroscope binary
8489

8590
.PHONY: release
8691
release/prereq: $(BIN)/goreleaser ## Ensure release pre requesites are met
@@ -110,18 +115,31 @@ release/build: release/prereq ## Build current platform release binaries
110115
go/deps:
111116
$(GO) mod tidy
112117

113-
define go_build
118+
define go_build_pyroscope
114119
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 $(GO) build -tags "netgo $(EMBEDASSETS)" -ldflags "-extldflags \"-static\" $(1)" ./cmd/pyroscope
120+
endef
121+
122+
define go_build_profilecli
115123
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 $(GO) build -ldflags "-extldflags \"-static\" $(1)" ./cmd/profilecli
116124
endef
117125

118126
.PHONY: go/bin-debug
119127
go/bin-debug:
120-
$(call go_build,$(GO_LDFLAGS))
128+
$(call go_build_pyroscope,$(GO_LDFLAGS))
129+
$(call go_build_profilecli,$(GO_LDFLAGS))
121130

122131
.PHONY: go/bin
123132
go/bin:
124-
$(call go_build,-s -w $(GO_LDFLAGS))
133+
$(call go_build_pyroscope,-s -w $(GO_LDFLAGS))
134+
$(call go_build_profilecli,-s -w $(GO_LDFLAGS))
135+
136+
.PHONY: go/bin-pyroscope-debug
137+
go/bin-pyroscope-debug:
138+
$(call go_build_pyroscope,$(GO_LDFLAGS))
139+
140+
.PHONY: go/bin-profilecli-debug
141+
go/bin-profilecli:
142+
$(call go_build_profilecli,$(GO_LDFLAGS))
125143

126144
.PHONY: go/lint
127145
go/lint: $(BIN)/golangci-lint
@@ -180,7 +198,7 @@ define deploy
180198
--set pyroscope.podAnnotations."profiles\.grafana\.com\/goroutine\.port_name"=http-metrics \
181199
--set pyroscope.extraEnvVars.JAEGER_AGENT_HOST=jaeger.monitoring.svc.cluster.local. \
182200
--set pyroscope.extraArgs."pyroscopedb\.max-block-duration"=5m
183-
endef
201+
endef
184202

185203
.PHONY: docker-image/pyroscope/build-debug
186204
docker-image/pyroscope/build-debug: GOOS=linux

0 commit comments

Comments
 (0)