Skip to content

Commit 779c3a3

Browse files
author
Kate Osborn
committed
Add debug makefile targets
1 parent f67db1e commit 779c3a3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,15 @@ generate-njs-yaml: ## Generate the njs-modules ConfigMap
103103
lint-helm: ## Run the helm chart linter
104104
helm lint $(CHART_DIR)
105105

106+
debug-build: ## Build binary with debug info, symbols, and no optimizations
107+
ifeq (${TARGET},local)
108+
@go version || (code=$$?; printf "\033[0;31mError\033[0m: unable to build locally\n"; exit $$code)
109+
CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) go build -trimpath -a -gcflags "all=-N -l" -ldflags "-X main.version=${VERSION} -X main.commit=${GIT_COMMIT} -X main.date=${DATE}" -o $(OUT_DIR)/gateway github.com/nginxinc/nginx-kubernetes-gateway/cmd/gateway
110+
endif
111+
112+
debug-container: debug-build ## Build container with debug binary
113+
@docker -v || (code=$$?; printf "\033[0;31mError\033[0m: there was a problem with Docker\n"; exit $$code)
114+
docker build --platform linux/$(ARCH) $(strip $(DOCKER_BUILD_OPTIONS)) --target $(strip $(TARGET)) -f build/Dockerfile -t $(strip $(PREFIX)):$(strip $(TAG)) .
115+
106116
.PHONY: dev-all
107117
dev-all: deps fmt njs-fmt vet lint unit-test njs-unit-test ## Run all the development checks

0 commit comments

Comments
 (0)