Newer
Older
OktaOauth / Makefile
@Yangyang Xie Yangyang Xie on 12 Jun 2022 1 KB first commit
# Image URL to use all building/pushing image targets
IMG ?= docker.jerxie.com/okta-oauth:latest

.PHONY: fmt
fmt: ## Run go fmt against code.
	go fmt ./...

.PHONY: vet
vet: ## Run go vet against code.
	go vet ./...

##@ Build

.PHONY: build
build: fmt vet ## Build manager binary.
	go build -o bin/main main.go

.PHONY: test
test: fmt vet
	go test ./...

.PHONY: run
run: fmt vet
	go run ./main.go


.PHONY: docker-build
docker-build: test ## Build docker image with the manager.
	docker build -t ${IMG} .

.PHONY: docker-push
docker-push: ## Push docker image with the manager.
	docker push ${IMG}


## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
	mkdir -p $(LOCALBIN)

## Tool Binaries
KUSTOMIZE ?= $(LOCALBIN)/kustomize

## Tool Versions
KUSTOMIZE_VERSION ?= v3.8.7

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
$(KUSTOMIZE): $(LOCALBIN)
	rm $(KUSTOMIZE) && curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN)

.PHONY: deploy
deploy: kustomize
	cd config/default && $(KUSTOMIZE) edit set image okta-oauth=$(IMG)
	$(KUSTOMIZE) build config/default | kubectl apply -f -

.PHONY: undeploy
undeploy: kustomize
	cd config/default && $(KUSTOMIZE) edit set image okta-oauth=$(IMG)
	$(KUSTOMIZE) build config/default | kubectl delete -f -

.PHONY: all
all: build docker-build docker-push undeploy deploy