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

Commit

Permalink
Add Podman support to policies Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewFerr authored and sandhose committed Feb 29, 2024
1 parent 183f7ba commit d5e1127
Showing 1 changed file with 9 additions and 4 deletions.
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

0 comments on commit d5e1127

Please sign in to comment.