Skip to content

Commit 05a6d57

Browse files
committed
api: Support podman for building api
This patch updates the Makefile used to build the API bindings to support Podman. Signed-off-by: akutz <[email protected]>
1 parent 3d8b026 commit 05a6d57

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

gen/Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ SHELL := /usr/bin/env bash
1010
# Print the help/usage when make is executed without any other arguments
1111
.DEFAULT_GOAL := help
1212

13+
# CRI_BIN is the path to the container runtime binary.
14+
ifeq (,$(strip $(GITHUB_RUN_ID)))
15+
# Prefer podman locally.
16+
CRI_BIN := $(shell command -v podman 2>/dev/null || command -v docker 2>/dev/null)
17+
else
18+
# Prefer docker in GitHub actions.
19+
CRI_BIN := $(shell command -v docker 2>/dev/null || command -v podman 2>/dev/null)
20+
endif
21+
export CRI_BIN
22+
1323

1424
## --------------------------------------
1525
## Help
@@ -30,7 +40,7 @@ IMAGE ?= $(IMAGE_NAME):$(IMAGE_TAG)
3040

3141
.PHONY: image-build
3242
image-build: ## Build the image for generating types
33-
docker build -t $(IMAGE) .
43+
$(CRI_BIN) build -t $(IMAGE) .
3444

3545

3646
## --------------------------------------
@@ -49,7 +59,7 @@ ABS_PATH_PARENT_DIR := $(abspath $(dir $(shell pwd)))
4959
generate-types: image-build
5060
generate-types: ## Generate the types
5161
@cp -f Gemfile.lock .Gemfile.lock.tmp
52-
docker run -it --rm \
62+
$(CRI_BIN) run -it --rm \
5363
-v $(ABS_PATH_PARENT_DIR):/govmomi \
5464
-v $(ABS_PATH_PARENT_DIR)/gen/.Gemfile.lock.tmp:/govmomi/gen/Gemfile.lock \
5565
$(IMAGE) \

0 commit comments

Comments
 (0)