You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Makefile
+20-12
Original file line number
Diff line number
Diff line change
@@ -1,33 +1,41 @@
1
+
# variables that should not be overridden by the user
1
2
VERSION = edge
2
-
TAG = $(VERSION)
3
-
PREFIX ?= nginx-kubernetes-gateway
4
-
5
-
GIT_COMMIT = $(shell git rev-parse HEAD)
3
+
GIT_COMMIT = $(shell git rev-parse HEAD || echo "unknown")
6
4
DATE = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
7
5
8
-
TARGET ?= local
9
-
10
-
KIND_KUBE_CONFIG_FOLDER = $${HOME}/.kube/kind
11
-
OUT_DIR=$(shell pwd)/build/.out
6
+
# variables that can be overridden by the user
7
+
PREFIX ?= nginx-kubernetes-gateway ## The name of the image. For example, nginx-kubernetes-gateway
8
+
TAG ?= $(VERSION:v%=%)## The tag of the image. For example, 0.3.0
9
+
TARGET ?= local ## The target of the build. Possible values: local and container
10
+
KIND_KUBE_CONFIG_FOLDER = $${HOME}/.kube/kind ## The folder where the kind kubeconfig is stored
11
+
OUT_DIR ?= $(shell pwd)/build/out ## The folder where the binary will be stored
12
+
ARCH ?= amd64 ## The architecture of the image and/or binary. For example: amd64 or arm64
13
+
override DOCKER_BUILD_OPTIONS += --build-arg VERSION=$(VERSION) --build-arg GIT_COMMIT=$(GIT_COMMIT) --build-arg DATE=$(DATE)## The options for the docker build command. For example, --pull
@go version || (code=$$?; printf "\033[0;31mError\033[0m: unable to build locally\n"; exit $$code)
28
-
CGO_ENABLED=0 GOOS=linux go build -trimpath -a -ldflags "-s -w -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
31
+
CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) go build -trimpath -a -ldflags "-s -w -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
29
32
endif
30
33
34
+
.PHONY: build-goreleaser
35
+
build-goreleaser: ## Build the binary using GoReleaser
36
+
@goreleaser -v || (code=$$?;printf"\033[0;31mError\033[0m: there was a problem with GoReleaser. Follow the docs to install it https://goreleaser.com/install\n";exit$$code)
0 commit comments