Skip to content

Commit

Permalink
Include Makefile rules for podman build
Browse files Browse the repository at this point in the history
This change allows controller and controller bundle
generation through podman, by using next commands:

make podman-build podman-push DOCKER_TAG=quay.io/{quay_user}/attestation-operator:v0.1.0
make podman-bundle DOCKER_TAG=quay.io/{quay_user_here}/attestation-operator:v0.1.0
make podman-bundle-build podman-bundle-push BUNDLE_IMG="quay.io/{quay_user}/attestation-operator-bundle:v0.1.0"

Resolves: #62

Signed-off-by: Sergio Arroutbi <[email protected]>
  • Loading branch information
sarroutbi committed Feb 13, 2024
1 parent b9cc020 commit 75ddc72
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
30 changes: 27 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ DOCKER_BUILDX_FLAGS ?=
DOCKER_PLATFORMS ?= linux/amd64
DOCKER_NO_VERSION_TAG ?= quay.io/keylime/keylime_attestation_operator
DOCKER_TAG ?= $(DOCKER_NO_VERSION_TAG):$(VERSION)
DOCKER_BIN ?= docker

# helm chart version must be semver 2 compliant
HELM_CHART_REPO ?= ghcr.io/keylime/helm-charts
Expand Down Expand Up @@ -227,7 +228,7 @@ $(HELMIFY): $(LOCALBIN)

.PHONY: docker-build
docker-build: ## Builds the application in a docker container and creates a docker image
docker buildx build \
$(DOCKER_BIN) buildx build \
-f $(MKFILE_DIR)/build/docker/attestation-operator/Dockerfile \
-t $(DOCKER_TAG) \
--progress=plain \
Expand All @@ -240,7 +241,17 @@ docker-build: ## Builds the application in a docker container and creates a dock

.PHONY: docker-push
docker-push: ## Pushes a previously built docker container
docker push $(DOCKER_TAG)
$(DOCKER_BIN) push $(DOCKER_TAG)

##@ Podman Build

.PHONY: podman-build
podman-build: ## Builds the application in a podman container and creates a docker image
DOCKER_BIN=podman $(MAKE) docker-build

.PHONY: podman-push
podman-push: ## Pushes a previously built podman container
DOCKER_BIN=podman $(MAKE) docker-push

helm: helm-keylime helm-crds helm-controller ## Builds all helm charts

Expand Down Expand Up @@ -393,12 +404,25 @@ bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metada

.PHONY: bundle-build
bundle-build: ## Build the bundle image.
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
$(DOCKER_BIN) build -f bundle.Dockerfile -t $(BUNDLE_IMG) .

.PHONY: bundle-push
bundle-push: ## Push the bundle image.
$(MAKE) docker-push DOCKER_TAG=$(BUNDLE_IMG)

# Bundle generation through podman
.PHONY: podman-bundle
podman-bundle: ## Build the bundle through podman.
DOCKER_BIN=podman $(MAKE) bundle

.PHONY: podman-bundle-build
podman-bundle-build: ## Build the bundle image through podman.
DOCKER_BIN=podman $(MAKE) bundle-build

.PHONY: podman-bundle-push
podman-bundle-push: ## Push the bundle image through podman.
DOCKER_BIN=podman $(MAKE) bundle-push

.PHONY: opm
OPM = ./bin/opm
opm: ## Download opm locally if necessary.
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,19 @@ e) `make helm-undeploy` will remove the whole deployment
Operator can be deployed with operator-sdk, as it has olm/bundle support.
To do so, you will need `operator-sdk` to be installed.
Follow next instructions to compile, upload and deploy through operator-sdk:
* Compile controller:
* Compile controller, generate bundle and push it to registry:
```bash
make docker-build docker-push DOCKER_TAG=quay.io/{quay_user}/attestation-operator:v0.1.0
```
* Generate bundle and push it to registry:
```bash
make bundle DOCKER_TAG=quay.io/{quay_user_here}/attestation-operator:v0.1.0
make bundle-build bundle-push BUNDLE_IMG="quay.io/{quay_user}/attestation-operator-bundle:v0.1.0"
```
It is possible to generate controller and bundle through `podman`. To do so, previous steps must be
replaced with appropriate podman rules:
```bash
make podman-build podman-push DOCKER_TAG=quay.io/{quay_user}/attestation-operator:v0.1.0
make podman-bundle DOCKER_TAG=quay.io/{quay_user_here}/attestation-operator:v0.1.0
make podman-bundle-build podman-bundle-push BUNDLE_IMG="quay.io/{quay_user}/attestation-operator-bundle:v0.1.0"
```
* Deploy through `operator-sdk` tool:
```bash
operator-sdk run bundle quay.io/{quay_user}/attestation-operator-bundle:v0.1.0
Expand Down

0 comments on commit 75ddc72

Please sign in to comment.