# Cerbos-Orchard-Docker
Demonstrates how we can build a standalone Cerbos docker container

## Directory Structure
```
policies/
    _schemas/
        *.json
    *.yml
conf.default.yaml
```
* policies are stored under `policies/` directory
* validation schemas are stored under `policies/_schemas/` directory
* `conf.default.yaml` describes the configurations to use for cerbos server
* `Dockerfile`.watch is helpful if you'd like to mount the volume and have cerbos server watch for live edits/refresh policy based on what you change during development
* `Dockerfile.binary` is closer to what we'd use to deploy a static version of policies

## Build and Run Image

```sh
docker build -f Dockerfile.watch -t orchard-cerbos-watching .

# As a PDP server, exposed on http://localhost:8080:
docker run -p 8080:3592 --name cerbos-watch --mount type=bind,source="$(pwd)"/policies,target=/policies,readonly orchard-cerbos-watching

# Compile and test policies:
docker exec cerbos-watch /cerbos compile /policies
```

```sh
docker build -f Dockerfile.binary -t orchard-cerbos-from-binary .

# As a PDP server, exposed on http://localhost:8080:
docker run -p 8080:3592 --name cerbos-binary orchard-cerbos-from-binary

# Compile and test policies
docker exec cerbos-binary /cerbos compile /policies
```
