22VERSION = edge
33GIT_COMMIT = $(shell git rev-parse HEAD || echo "unknown")
44DATE = $(shell date -u +"% Y-% m-% dT% H:% M:% SZ")
5- MANIFEST_DIR = $(shell pwd ) /deploy/manifests
6- CHART_DIR = $(shell pwd ) /deploy/helm-chart
5+ MANIFEST_DIR = $(CURDIR ) /deploy/manifests
6+ CHART_DIR = $(CURDIR ) /deploy/helm-chart
77NGINX_CONF_DIR = internal/mode/static/nginx/conf
88NJS_DIR = internal/mode/static/nginx/modules/src
99NGINX_DOCKER_BUILD_PLUS_ARGS = --secret id=nginx-repo.crt,src=nginx-repo.crt --secret id=nginx-repo.key,src=nginx-repo.key
1010BUILD_AGENT =local
1111TELEMETRY_REPORT_PERIOD = 24h # also configured in goreleaser.yml
1212GW_API_VERSION = 1.0.0
1313INSTALL_WEBHOOK = false
14+ NODE_VERSION = $(shell cat .nvmrc)
1415
1516# go build flags - should not be overridden by the user
1617GO_LINKER_FlAGS_VARS = -X main.version=${VERSION} -X main.commit=${GIT_COMMIT} -X main.date=${DATE} -X main.telemetryReportPeriod=${TELEMETRY_REPORT_PERIOD}
@@ -24,7 +25,7 @@ NGINX_PLUS_PREFIX ?= $(PREFIX)/nginx-plus## The name of the nginx plus image. Fo
2425TAG ?= $(VERSION:v%=% ) # # The tag of the image. For example, 0.3.0
2526TARGET ?= local# # The target of the build. Possible values: local and container
2627KIND_KUBE_CONFIG=$${HOME}/.kube/kind/config# # The location of the kind kubeconfig
27- OUT_DIR ?= $(shell pwd ) /build/out# # The folder where the binary will be stored
28+ OUT_DIR ?= $(CURDIR ) /build/out# # The folder where the binary will be stored
2829GOARCH ?= amd64# # The architecture of the image and/or binary. For example: amd64 or arm64
2930GOOS ?= linux# # The OS of the image and/or binary. For example: linux or darwin
3031override HELM_TEMPLATE_COMMON_ARGS += --set creator=template --set nameOverride=nginx-gateway# # The common options for the Helm template command.
@@ -125,17 +126,17 @@ fmt: ## Run go fmt against code
125126.PHONY : njs-fmt
126127njs-fmt : # # Run prettier against the njs httpmatches module
127128 docker run --rm -w /modules \
128- -v $(PWD ) /internal/nginx/modules/:/modules/ \
129- node:18 \
130- /bin/bash -c " npm install && npm run format"
129+ -v $(CURDIR ) /internal/nginx/modules/:/modules/ \
130+ node:${NODE_VERSION} \
131+ /bin/bash -c " npm ci && npm run format"
131132
132133.PHONY : vet
133134vet : # # Run go vet against code
134135 go vet ./...
135136
136137.PHONY : lint
137138lint : # # Run golangci-lint against code
138- docker run --pull always --rm -v $(shell pwd ) :/nginx-gateway-fabric -w /nginx-gateway-fabric -v $(shell go env GOCACHE) :/cache/go -e GOCACHE=/cache/go -e GOLANGCI_LINT_CACHE=/cache/go -v $(shell go env GOPATH) /pkg:/go/pkg golangci/golangci-lint:latest golangci-lint --color always run
139+ docker run --pull always --rm -v $(CURDIR ) :/nginx-gateway-fabric -w /nginx-gateway-fabric -v $(shell go env GOCACHE) :/cache/go -e GOCACHE=/cache/go -e GOLANGCI_LINT_CACHE=/cache/go -v $(shell go env GOPATH) /pkg:/go/pkg golangci/golangci-lint:latest golangci-lint --color always run
139140
140141.PHONY : unit-test
141142unit-test : # # Run unit tests for the go code
@@ -148,9 +149,9 @@ unit-test: ## Run unit tests for the go code
148149.PHONY : njs-unit-test
149150njs-unit-test : # # Run unit tests for the njs httpmatches module
150151 docker run --rm -w /modules \
151- -v $(PWD ) /internal/mode/static/nginx/modules:/modules/ \
152- node:18 \
153- /bin/bash -c " npm install && npm test && npm run clean"
152+ -v $(CURDIR ) /internal/mode/static/nginx/modules:/modules/ \
153+ node:${NODE_VERSION} \
154+ /bin/bash -c " npm ci && npm test && npm run clean"
154155
155156.PHONY : lint-helm
156157lint-helm : # # Run the helm chart linter
0 commit comments