dev-pod-api-build/Makefile
2026-04-16 04:16:36 +00:00

37 lines
918 B
Makefile

BINARY := dev-pod-api
IMAGE := dev-pod-api
REGISTRY := 10.22.0.56:30500
TAG := latest
FULL_IMAGE := $(REGISTRY)/$(IMAGE):$(TAG)
.PHONY: build test lint clean docker-build kaniko-build
## Build the binary locally
build:
CGO_ENABLED=0 go build -ldflags="-s -w" -o $(BINARY) .
## Run tests
test:
go test ./... -v -count=1
## Run linter
lint:
golangci-lint run ./...
## Remove build artifacts
clean:
rm -f $(BINARY)
## Build Docker image locally
docker-build:
docker build -t $(FULL_IMAGE) .
## Build via kaniko (run from a k8s Job with build context mounted)
## This target generates the kaniko Job manifest and applies it.
kaniko-build:
@echo "To build via kaniko, apply the kaniko job manifest:"
@echo " kubectl apply -f k8s/dev-infra/dev-pod-api-kaniko.yaml"
@echo ""
@echo "Or build locally and push:"
@echo " docker build -t $(FULL_IMAGE) ."
@echo " docker push $(FULL_IMAGE)"