Skip to content

Commit 5592651

Browse files
feat: include zentinel binary in Docker image for bundle validation
Download and SHA256-verify the zentinel binary during the Docker build so bundle compilation works out-of-the-box in containerized deployments.
1 parent bc52aa4 commit 5592651

4 files changed

Lines changed: 29 additions & 7 deletions

File tree

Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,25 @@ ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}"
77

88
FROM ${BUILDER_IMAGE} AS builder
99

10+
ARG ZENTINEL_VERSION=26.02_13
11+
ARG TARGETARCH
12+
1013
RUN apt-get update -y && \
1114
apt-get install -y build-essential git curl && \
1215
apt-get clean && rm -rf /var/lib/apt/lists/*
1316

17+
# Download and verify the zentinel binary (used for bundle validation)
18+
RUN ARCH=$(case "${TARGETARCH}" in arm64) echo "aarch64";; *) echo "x86_64";; esac) && \
19+
TARBALL="zentinel-${ZENTINEL_VERSION}-linux-${ARCH}.tar.gz" && \
20+
URL="https://github.com/zentinelproxy/zentinel/releases/download/${ZENTINEL_VERSION}/${TARBALL}" && \
21+
curl -fSL "${URL}" -o "/tmp/${TARBALL}" && \
22+
curl -fSL "${URL}.sha256" -o "/tmp/${TARBALL}.sha256" && \
23+
cd /tmp && sha256sum -c "${TARBALL}.sha256" && \
24+
tar -xzf "/tmp/${TARBALL}" -C /tmp && \
25+
mv /tmp/zentinel /usr/local/bin/zentinel && \
26+
chmod +x /usr/local/bin/zentinel && \
27+
rm -f "/tmp/${TARBALL}" "/tmp/${TARBALL}.sha256"
28+
1429
WORKDIR /app
1530

1631
# Install hex + rebar
@@ -65,6 +80,10 @@ ENV PHX_SERVER=true
6580
# Copy the release from the build stage
6681
COPY --from=builder /app/_build/prod/rel/zentinel_cp ./
6782

83+
# Copy the zentinel binary for bundle validation
84+
COPY --from=builder /usr/local/bin/zentinel /usr/local/bin/zentinel
85+
ENV ZENTINEL_BINARY=/usr/local/bin/zentinel
86+
6887
# Copy entrypoint script
6988
COPY entrypoint.sh /app/entrypoint.sh
7089

docs/CONFIGURATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ Supported providers: GitHub, GitLab, Bitbucket, Gitea, generic (HMAC-verified).
198198
| `S3_SECRET_ACCESS_KEY` | Yes || S3 secret key |
199199
| `S3_REGION` | No | `us-east-1` | S3 region |
200200
| `ZENTINEL_BINARY` | No | `zentinel` | Path to zentinel CLI |
201+
| `ZENTINEL_VERSION` | No | `26.02_13` | Zentinel binary version (Docker build arg) |
201202
| `GITHUB_WEBHOOK_SECRET` | No || GitHub webhook HMAC secret |
202203
| `OTEL_EXPORTER_OTLP_ENDPOINT` | No || OpenTelemetry endpoint |
203204
| `FORCE_SSL` | No | `false` | Redirect HTTP → HTTPS |

docs/DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
- Elixir 1.16+ / Erlang OTP 26+ (managed via [mise](https://mise.jdx.dev/))
66
- Docker — for MinIO (bundle storage)
7-
- `zentinel` CLI binary — for configuration validation during bundle compilation
7+
- `zentinel` CLI binary — for configuration validation during bundle compilation (Docker deployment includes this automatically)
88

99
## Setup
1010

docs/GETTING-STARTED.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ docker compose up
2222
What happens:
2323

2424
1. Multi-stage Dockerfile builds the Elixir release (base: `hexpm/elixir:1.19.5-erlang-28.3.1-debian-bookworm`)
25-
2. PostgreSQL 17 starts (port 5432, user: `zentinel`, password: `zentinel`)
26-
3. MinIO starts (port 9000 API, port 9001 console)
27-
4. `minio-init` container creates the `zentinel-bundles` bucket
28-
5. App waits for PostgreSQL readiness (`pg_isready`), runs Ecto migrations
29-
6. Database seeded with default org and admin user
30-
7. Control plane available at **http://localhost:4000**
25+
2. The `zentinel` binary is downloaded and verified during image build — bundle validation works out-of-the-box
26+
3. PostgreSQL 17 starts (port 5432, user: `zentinel`, password: `zentinel`)
27+
4. MinIO starts (port 9000 API, port 9001 console)
28+
5. `minio-init` container creates the `zentinel-bundles` bucket
29+
6. App waits for PostgreSQL readiness (`pg_isready`), runs Ecto migrations
30+
7. Database seeded with default org and admin user
31+
8. Control plane available at **http://localhost:4000**
3132

3233
MinIO console: **http://localhost:9001** (credentials: `minioadmin` / `minioadmin`)
3334

@@ -58,6 +59,7 @@ docker compose down -v
5859
| `S3_SECRET_ACCESS_KEY` | `minioadmin` | MinIO secret key |
5960
| `S3_REGION` | `us-east-1` | S3 region |
6061
| `PORT` | `4000` | HTTP listen port |
62+
| `ZENTINEL_VERSION` | `26.02_13` | Zentinel binary version (Docker build arg) |
6163

6264
## Local Development
6365

0 commit comments

Comments
 (0)