Skip to content

Commit

Permalink
[RHOAIENG-7484] - make container builder configurable for odh-control…
Browse files Browse the repository at this point in the history
…ler operator

chore:	Allow to set the engine for the make container build and push goals

Signed-off-by: Spolti <[email protected]>
  • Loading branch information
spolti committed May 20, 2024
1 parent 373d84f commit 2e072c8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
23 changes: 17 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ IMG ?= quay.io/${USER}/odh-model-controller:latest
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.26

ENGINE ?= docker
#####################################
# Podman only parameter
ARCH ?= x86_64
# Default for docker, no value
ARCH_PARAMETER =
ifeq ($(ENGINE),podman)
ARCH_PARAMETER = --arch $(ARCH)
endif
#####################################

# Setting SHELL to bash allows bash commands to be executed by recipes.
# This is a requirement for 'setup-envtest.sh' in the test target.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
Expand Down Expand Up @@ -83,13 +94,13 @@ build: generate fmt vet ## Build manager binary.
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 . -f ./Containerfile -t ${IMG}
.PHONY: container-build
container-build: test ## Build docker image with the manager.
${ENGINE} build . ${ARCH_PARAMETER} -f ./Containerfile -t ${IMG}

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

##@ Deployment

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Build a new image with your local changes and push it to `<YOUR_IMAGE>` (by
default `quay.io/${USER}/odh-model-controller:latest`).

```shell
make -e IMG=<YOUR_IMAGE> docker-build docker-push
make -e IMG=<YOUR_IMAGE> container-build container-push
```

Deploy the manager using the image in your registry:
Expand Down

0 comments on commit 2e072c8

Please sign in to comment.