Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Add Podman support to policies Makefile #2425

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions policies/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Set to 1 to run OPA through Docker
DOCKER := 0
PODMAN := 0
OPA_DOCKER_IMAGE := docker.io/openpolicyagent/opa:0.59.0-debug

INPUTS := \
Expand All @@ -9,12 +10,16 @@ INPUTS := \
password.rego \
email.rego

ifeq ($(DOCKER), 0)
OPA := opa
OPA_RW := opa
else
ifeq ($(DOCKER), 1)
OPA := docker run -i -v $(shell pwd):/policies:ro -w /policies --rm $(OPA_DOCKER_IMAGE)
OPA_RW := docker run -i -v $(shell pwd):/policies -w /policies --rm $(OPA_DOCKER_IMAGE)
else ifeq ($(PODMAN), 1)
# When running rootless, the volume directory may need to be given global write permissions on the host
OPA := podman run -i -v $(shell pwd):/policies:ro:Z -w /policies --rm $(OPA_DOCKER_IMAGE)
OPA_RW := podman run -i -v $(shell pwd):/policies:Z -w /policies --rm $(OPA_DOCKER_IMAGE)
else
OPA := opa
OPA_RW := opa
endif

policy.wasm: $(INPUTS)
Expand Down
Loading