Skip to content

Commit bbe28eb

Browse files
author
Shaul Kremer
committed
Added a client-cedar Docker image.
1 parent c184b80 commit bbe28eb

File tree

4 files changed

+39
-1
lines changed

4 files changed

+39
-1
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "cedar-agent"]
2+
path = cedar-agent
3+
url = https://github.com/permitio/cedar-agent.git

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ install-develop:
4141
docker-build-client:
4242
@docker build -t permitio/opal-client --target client -f docker/Dockerfile .
4343

44+
docker-build-client-cedar:
45+
@docker build -t permitio/opal-client-cedar --target client-cedar -f docker/Dockerfile .
46+
4447
docker-build-client-standalone:
4548
@docker build -t permitio/opal-client-standalone --target client-standalone -f docker/Dockerfile .
4649

cedar-agent

Submodule cedar-agent added at b5cdcce

docker/Dockerfile

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ COPY ./packages/opal-server/requires.txt ./server_requires.txt
1212
# install python deps
1313
RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir -r ./base_requires.txt -r ./common_requires.txt -r ./client_requires.txt -r ./server_requires.txt
1414

15+
# CEDAR AGENT BUILD STAGE ---------------------------
16+
# split this stage to save time and reduce image size
17+
# ---------------------------------------------------
18+
FROM rust:1.69.0 as cedar-builder
19+
COPY cedar-agent /tmp/cedar-agent/
20+
ARG cargo_flags="-r"
21+
RUN cd /tmp/cedar-agent && \
22+
cargo build ${cargo_flags} && \
23+
cp /tmp/cedar-agent/target/*/cedar-agent /
24+
1525
# COMMON IMAGE --------------------------------------
1626
# ---------------------------------------------------
1727
FROM python:3.10-slim as common
@@ -70,6 +80,8 @@ RUN mkdir -p /opal/backup
7080
VOLUME /opal/backup
7181

7282

83+
# IMAGE to extract OPA from official image ----------
84+
# ---------------------------------------------------
7385
FROM alpine:latest as opa-extractor
7486
USER root
7587

@@ -85,7 +97,7 @@ RUN skopeo copy "docker://${opa_image}:${opa_tag}" docker-archive:./image.tar &&
8597
rm -r image image.tar
8698

8799

88-
# CLIENT IMAGE --------------------------------------
100+
# OPA CLIENT IMAGE ----------------------------------
89101
# Using standalone image as base --------------------
90102
# ---------------------------------------------------
91103
FROM client-standalone as client
@@ -104,6 +116,25 @@ ENV OPAL_INLINE_OPA_ENABLED=true
104116
EXPOSE 8181
105117
USER opal
106118

119+
# CEDAR CLIENT IMAGE --------------------------------
120+
# Using standalone image as base --------------------
121+
# ---------------------------------------------------
122+
FROM client-standalone as client-cedar
123+
124+
# Temporarily move back to root for additional setup
125+
USER root
126+
127+
RUN apt-get update && apt-get install -y netcat jq && apt-get clean
128+
129+
# copy cedar from its build stage
130+
COPY --from=cedar-builder /cedar-agent /cedar-agent
131+
132+
# enable inline Cedar agent
133+
ENV OPAL_INLINE_CEDAR_ENABLED=true
134+
# expose cedar port
135+
EXPOSE 8180
136+
USER opal
137+
107138
# SERVER IMAGE --------------------------------------
108139
# ---------------------------------------------------
109140
FROM common as server

0 commit comments

Comments
 (0)