Skip to content

Commit b88f824

Browse files
sarroutbimaugustosilva
authored andcommitted
Include Makefile rules for podman build
This change allows controller and controller bundle generation through podman, by using next commands: ```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" ``` Resolves: #62 Signed-off-by: Sergio Arroutbi <[email protected]>
1 parent 908bcc8 commit b88f824

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

Makefile

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ DOCKER_BUILDX_FLAGS ?=
2323
DOCKER_PLATFORMS ?= linux/amd64
2424
DOCKER_NO_VERSION_TAG ?= quay.io/keylime/keylime_attestation_operator
2525
DOCKER_TAG ?= $(DOCKER_NO_VERSION_TAG):$(VERSION)
26+
DOCKER_BIN ?= docker
2627

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

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

241242
.PHONY: docker-push
242243
docker-push: ## Pushes a previously built docker container
243-
docker push $(DOCKER_TAG)
244+
$(DOCKER_BIN) push $(DOCKER_TAG)
245+
246+
##@ Podman Build
247+
248+
.PHONY: podman-build
249+
podman-build: ## Builds the application in a podman container and creates a docker image
250+
DOCKER_BIN=podman $(MAKE) docker-build
251+
252+
.PHONY: podman-push
253+
podman-push: ## Pushes a previously built podman container
254+
DOCKER_BIN=podman $(MAKE) docker-push
244255

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

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

394405
.PHONY: bundle-build
395406
bundle-build: ## Build the bundle image.
396-
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
407+
$(DOCKER_BIN) build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
397408

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

413+
# Bundle generation through podman
414+
.PHONY: podman-bundle
415+
podman-bundle: ## Build the bundle through podman.
416+
DOCKER_BIN=podman $(MAKE) bundle
417+
418+
.PHONY: podman-bundle-build
419+
podman-bundle-build: ## Build the bundle image through podman.
420+
DOCKER_BIN=podman $(MAKE) bundle-build
421+
422+
.PHONY: podman-bundle-push
423+
podman-bundle-push: ## Push the bundle image through podman.
424+
DOCKER_BIN=podman $(MAKE) bundle-push
425+
402426
.PHONY: opm
403427
OPM = ./bin/opm
404428
opm: ## Download opm locally if necessary.

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,19 @@ e) `make helm-undeploy` will remove the whole deployment
7878
Operator can be deployed with operator-sdk, as it has olm/bundle support.
7979
To do so, you will need `operator-sdk` to be installed.
8080
Follow next instructions to compile, upload and deploy through operator-sdk:
81-
* Compile controller:
81+
* Compile controller, generate bundle and push it to registry:
8282
```bash
8383
make docker-build docker-push DOCKER_TAG=quay.io/{quay_user}/attestation-operator:v0.1.0
84-
```
85-
* Generate bundle and push it to registry:
86-
```bash
8784
make bundle DOCKER_TAG=quay.io/{quay_user_here}/attestation-operator:v0.1.0
8885
make bundle-build bundle-push BUNDLE_IMG="quay.io/{quay_user}/attestation-operator-bundle:v0.1.0"
8986
```
87+
It is possible to generate controller and bundle through `podman`. To do so, previous steps must be
88+
replaced with appropriate podman rules:
89+
```bash
90+
make podman-build podman-push DOCKER_TAG=quay.io/{quay_user}/attestation-operator:v0.1.0
91+
make podman-bundle DOCKER_TAG=quay.io/{quay_user_here}/attestation-operator:v0.1.0
92+
make podman-bundle-build podman-bundle-push BUNDLE_IMG="quay.io/{quay_user}/attestation-operator-bundle:v0.1.0"
93+
```
9094
* Deploy through `operator-sdk` tool:
9195
```bash
9296
operator-sdk run bundle quay.io/{quay_user}/attestation-operator-bundle:v0.1.0

0 commit comments

Comments
 (0)