Skip to content

Commit 3ac430e

Browse files
speed up cedar client build (#771)
* speed up cedar client build * test1 * Ready for CR * Ready for CR * change to cedar-agent image * check2 * check by image * ready for cr * check with 0.2.0 * without cedar-agent build * wip1 * wip2 * wip3 * wip4 * wip5 * Ready for CR
1 parent 8062e4a commit 3ac430e

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

docker/Dockerfile

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ 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.79 AS cedar-builder
19-
COPY ./cedar-agent /tmp/cedar-agent
20-
WORKDIR /tmp/cedar-agent
21-
RUN CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse cargo build --release
22-
2315
# COMMON IMAGE --------------------------------------
2416
# ---------------------------------------------------
2517
FROM python:3.10-slim-bookworm AS common
@@ -124,13 +116,18 @@ USER opal
124116
# CEDAR CLIENT IMAGE --------------------------------
125117
# Using standalone image as base --------------------
126118
# ---------------------------------------------------
119+
# Extract the Cedar Agent binary from the existing image
120+
# CEDAR AGENT DOWNLOAD STAGE -----------------------
121+
# Stage to locate and extract the cedar-agent binary
122+
FROM permitio/cedar-agent:0.2.0 AS cedar-extractor
123+
127124
FROM client-standalone AS client-cedar
128125

129126
# Temporarily move back to root for additional setup
130127
USER root
131128

132-
# Copy cedar from its build stage
133-
COPY --from=cedar-builder /tmp/cedar-agent/target/*/cedar-agent /bin/cedar-agent
129+
COPY --from=cedar-extractor /agent/cedar-agent /bin/cedar-agent
130+
RUN chmod +x /bin/cedar-agent
134131

135132
# enable inline Cedar agent
136133
ENV OPAL_POLICY_STORE_TYPE=CEDAR

0 commit comments

Comments
 (0)