Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
29 changes: 29 additions & 0 deletions .github/workflows/on_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,35 @@ jobs:
tags: |
permitio/opal-client-cedar:${{ github.event.release.tag_name }}

- name: Build & Push EOPA
if: ${{ github.event.release.prerelease == false }}
id: build_push_eopa_regular
uses: docker/build-push-action@v6
with:
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
target: client-eopa
cache-from: type=registry,ref=permitio/opal-client-eopa:latest
cache-to: type=inline
tags: |
permitio/opal-client-eopa:latest
permitio/opal-client-eopa:${{ github.event.release.tag_name }}

- name: Build & Push EOPA (prerelease)
if: ${{ github.event.release.prerelease == true }}
id: build_push_eopa_prerelease
uses: docker/build-push-action@v6
with:
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
target: client-eopa
cache-from: type=registry,ref=permitio/opal-client-eopa:latest
cache-to: type=inline
tags: |
permitio/opal-client-eopa:${{ github.event.release.tag_name }}

- name: Python setup
uses: actions/setup-python@v5
with:
Expand Down
43 changes: 41 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ WORKDIR /opal

# copy opa from official docker image
ARG opa_image=openpolicyagent/opa
ARG opa_tag=0.70.0-static
ARG opa_tag=1.9.0-static
RUN skopeo copy "docker://${opa_image}:${opa_tag}" docker-archive:./image.tar && \
mkdir image && tar xf image.tar -C ./image && cat image/*.tar | tar xf - -C ./image -i && \
find image/ -name "opa*" -type f -executable -print0 | xargs -0 -I "{}" cp {} ./opa && chmod 755 ./opa && \
Expand All @@ -109,7 +109,46 @@ COPY --from=opa-extractor /opal/opa ./opa
# enable inline OPA
ENV OPAL_INLINE_OPA_ENABLED=true
ENV OPAL_INLINE_OPA_EXEC_PATH=/opal/opa
# expose opa port

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: OPA Client Image Missing Port and User

The client Docker image is missing the EXPOSE 8181 and USER opal directives. These were moved to the client-eopa stage, which means the regular OPA client won't expose its required port 8181 and won't run as the opal user, making it non-functional for OPA queries.

Fix in Cursor Fix in Web

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit b5767ce - restored the missing EXPOSE 8181 and USER opal directives to the client stage (lines 113-114).

# EOPA BINARY DOWNLOAD STAGE ------------------------
# ---------------------------------------------------
FROM alpine:latest AS eopa-extractor
USER root

# Install download dependencies
RUN apk add --no-cache wget

# Set working directory
WORKDIR /download

# Download pre-built EOPA binary based on architecture
ARG eopa_tag=v1.44.0
ARG TARGETARCH
RUN case "${TARGETARCH}" in \
"amd64") EOPA_ARCH="x86_64" ;; \
"arm64") EOPA_ARCH="arm64" ;; \
*) echo "Unsupported architecture: ${TARGETARCH}" && exit 1 ;; \
esac && \
echo "Downloading EOPA for Linux_${EOPA_ARCH}" && \
wget -O eopa "https://github.com/open-policy-agent/eopa/releases/download/${eopa_tag}/eopa_Linux_${EOPA_ARCH}" && \
chmod +x eopa

# EOPA CLIENT IMAGE ---------------------------------
# Using standalone image as base --------------------
# ---------------------------------------------------
FROM client-standalone AS client-eopa

# Temporarily move back to root for additional setup
USER root

# copy eopa from eopa-extractor
COPY --from=eopa-extractor /download/eopa ./eopa

# enable inline EOPA
ENV OPAL_POLICY_STORE_TYPE=OPA
ENV OPAL_INLINE_OPA_ENABLED=true
ENV OPAL_INLINE_OPA_EXEC_PATH=/opal/eopa
# expose eopa port (same as OPA)
EXPOSE 8181
USER opal

Expand Down
Loading