From c29938f2bc0e4ea745c76efe4c3c95d3a0742074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Tue, 12 Mar 2024 18:50:26 +0100 Subject: [PATCH] feat: add ko build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché --- Makefile | 29 +++++++++++++++++++++++++++++ cmd/main.go => main.go | 0 2 files changed, 29 insertions(+) rename cmd/main.go => main.go (100%) diff --git a/Makefile b/Makefile index 5f39024f..cd6f720f 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,8 @@ else LD_FLAGS := "-s -w" endif KIND_IMAGE ?= kindest/node:v1.29.2 +KO_REGISTRY := ko.local +KO_TAGS := $(GIT_SHA) ######### # TOOLS # @@ -86,6 +88,33 @@ verify-codegen: codegen @echo 'To correct this, locally run "make codegen", commit the changes, and re-run tests.' >&2 @git diff --quiet --exit-code -- . +######### +# BUILD # +######### + +.PHONY: fmt +fmt: ## Run go fmt + @echo Go fmt... >&2 + @go fmt ./... + +.PHONY: vet +vet: ## Run go vet + @echo Go vet... >&2 + @go vet ./... + +############## +# BUILD (KO) # +############## + +.PHONY: build-ko +build-ko: ## Build Docker image with ko +build-ko: fmt +build-ko: vet +build-ko: $(KO) + @echo "Build Docker image with ko..." >&2 + @LD_FLAGS=$(LD_FLAGS) KO_DOCKER_REPO=$(KO_REGISTRY) \ + $(KO) build . --preserve-import-paths --tags=$(KO_TAGS) + ########## # MKDOCS # ########## diff --git a/cmd/main.go b/main.go similarity index 100% rename from cmd/main.go rename to main.go