Skip to content

Commit b4ceaed

Browse files
backport of commit fb4b42e (#27325)
Co-authored-by: Piotr Kazmierczak <[email protected]>
1 parent 7635f6e commit b4ceaed

File tree

7 files changed

+1161
-1093
lines changed

7 files changed

+1161
-1093
lines changed

.changelog/27310.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:improvement
2+
build: Add dev-static and static-release build targets that disable CGO and offer statically-linked binaries
3+
```

GNUmakefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,10 @@ dev: hclfmt ## Build for the current development platform
287287
@cp $(PROJECT_ROOT)/$(DEV_TARGET) $(PROJECT_ROOT)/bin/
288288
@cp $(PROJECT_ROOT)/$(DEV_TARGET) $(BIN)
289289

290+
.PHONY: dev-static
291+
dev-static:
292+
@$(MAKE) CGO_ENABLED=0 dev ## Build a dev binary with no CGO
293+
290294
.PHONY: prerelease
291295
prerelease: GO_TAGS=ui codegen_generated release
292296
prerelease: generate-all ember-dist static-assets ## Generate all the static assets for a Nomad release
@@ -297,6 +301,13 @@ release: clean $(foreach t,$(ALL_TARGETS),pkg/$(t).zip) ## Build all release pac
297301
@echo "==> Results:"
298302
@tree --dirsfirst $(PROJECT_ROOT)/pkg
299303

304+
.PHONY: release-static
305+
release-static: GO_TAGS=ui codegen_generated release
306+
release-static: CGO_ENABLED=0
307+
release-static: clean $(foreach t,$(ALL_TARGETS),pkg/$(t).zip) ## Build all release packages which can be built on this platform.
308+
@echo "==> Results:"
309+
@tree --dirsfirst $(PROJECT_ROOT)/pkg
310+
300311
.PHONY: test-nomad
301312
test-nomad: GOTEST_PKGS=$(foreach g,$(GOTEST_GROUP),$(shell go run -modfile=tools/go.mod tools/missing/main.go ci/test-core.json $(g)))
302313
test-nomad: # dev ## Run Nomad unit tests

0 commit comments

Comments
 (0)