Skip to content

Commit

Permalink
fixing Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
djkormo committed Feb 24, 2024
1 parent 97c8af6 commit b8b4707
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 8 deletions.
71 changes: 63 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@

dpl ?= deploy.env
include $(dpl)
export $(shell sed 's/=.*//' $(dpl))
# VERSION defines the project version for the bundle.
# Update this value when you upgrade the version of your project.
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 0.0.1

COMMIT?=$(shell git rev-parse --short HEAD)
BUILD_TIME?=$(shell date -u '+%Y-%m-%d_%H:%M:%S')

PROJECT?=github.com/nokia/adcs-issuer

# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
# To re-generate a bundle for other specific channels without changing the standard setup, you can:
Expand Down Expand Up @@ -107,23 +115,20 @@ vet: ## Run go vet against code.
test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out

.PHONY clean:
go clean

##@ Build

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

.PHONY: run
run: manifests generate fmt vet ## Run a controller from your host.
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}

##@ Deployment

Expand Down Expand Up @@ -254,3 +259,53 @@ sim-install: sim
mkdir -p /usr/local/adcs-sim
cp -R test/adcs-sim/ca test/adcs-sim/templates /usr/local/adcs-sim



.PHONY: operator-build
operator-build:
go clean
go fmt ## Build manager binary.
go vet
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} go build \
-ldflags "-s -w -X ${PROJECT}/version.Release=${VERSION} \
-X ${PROJECT}/version.Commit=${COMMIT} -X ${PROJECT}/version.BuildTime=${BUILD_TIME}" \
-o ${APP_NAME}



.PHONY: docker-build
docker-build: ## Build docker image with the manager.
DOCKER_BUILDKIT=1 docker build -t $(APP_NAME) . --progress=plain

.PHONY: docker-push
docker-push: ## Push docker image with the manager.
docker push $(APP_NAME)

# Docker publish
publish: repo-login publish-latest publish-version ## Publish the `{version}` ans `latest` tagged containers to ECR

publish-latest: tag-latest ## Publish the `latest` taged container to ECR
@echo 'publish latest to $(DOCKER_REPO)'
docker push $(DOCKER_REPO)/$(APP_NAME):latest

publish-version: tag-version ## Publish the `{version}` taged container to ECR
@echo 'publish $(VERSION) to $(DOCKER_REPO)'
docker push $(DOCKER_REPO)/$(APP_NAME):$(VERSION)

# Docker tagging
tag: tag-latest tag-version ## Generate container tags for the `{version}` ans `latest` tags

tag-latest: ## Generate container `{version}` tag
@echo 'create tag latest'
docker tag $(APP_NAME) $(DOCKER_REPO)/$(APP_NAME):latest

tag-version: ## Generate container `latest` tag
@echo 'create tag $(VERSION)'
docker tag $(APP_NAME) $(DOCKER_REPO)/$(APP_NAME):$(VERSION)



inspect: ## Generate container `latest` tag
@echo 'inspect $(APP_NAME)'
docker history $(APP_NAME)
docker inspect $(APP_NAME)
3 changes: 3 additions & 0 deletions deploy.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
APP_NAME=adcs-issuer
DOCKER_REPO=djkormo
VERSION=2.0.9

0 comments on commit b8b4707

Please sign in to comment.