Skip to content

Commit 5f7b54e

Browse files
committed
add a podman option to Makefile
This change allows a user to set `USE_PODMAN=1` when running the make command to force usage of podman instead of docker during the build and image targets. Also adds a note to the README about the `NO_DOCKER` and `USE_PODMAN` options.
1 parent 9c25a7c commit 5f7b54e

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,19 @@ endif
1919
.PHONY: all
2020
all: check build test
2121

22+
USE_PODMAN ?= 0
2223
NO_DOCKER ?= 0
2324
ifeq ($(NO_DOCKER), 1)
2425
DOCKER_CMD =
2526
IMAGE_BUILD_CMD = imagebuilder
2627
else
27-
DOCKER_CMD := docker run --env GO111MODULE=$(GO111MODULE) --env GOFLAGS=$(GOFLAGS) --rm -v "$(PWD)":/go/src/github.com/openshift/machine-api-operator:Z -w /go/src/github.com/openshift/machine-api-operator golang:1.13
28-
IMAGE_BUILD_CMD = docker build
28+
ifeq ($(USE_PODMAN), 1)
29+
OCI_BINARY = podman
30+
else
31+
OCI_BINARY = docker
32+
endif
33+
DOCKER_CMD := $(OCI_BINARY) run --env GO111MODULE=$(GO111MODULE) --env GOFLAGS=$(GOFLAGS) --rm -v "$(PWD)":/go/src/github.com/openshift/machine-api-operator:Z -w /go/src/github.com/openshift/machine-api-operator golang:1.13
34+
IMAGE_BUILD_CMD = $(OCI_BINARY) build
2935
endif
3036

3137
.PHONY: vendor

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ machine.openshift.io/cluster-api-machine-type: worker
8686
$ make image
8787
```
8888

89+
Please note that by default make will attempt to use the `docker` command
90+
to create binaries and images. If you would like to disable this behavior, set
91+
the environment variable `NO_DOCKER=1`. Alternatively if you woud like to use
92+
`podman`, set the environment variable `USE_PODMAN=1`.
93+
8994
The Machine API Operator is designed to work in conjunction with the [Cluster Version Operator](https://github.com/openshift/cluster-version-operator).
9095
You can see it in action by running an [OpenShift Cluster deployed by the Installer](https://github.com/openshift/installer).
9196

0 commit comments

Comments
 (0)