fix(docker): vendor arch-safe PIGuard daemon build for Apple Silicon - #86
Merged
Conversation
The upstream go-prompt-injection-guard Dockerfile pins its base images by amd64-only sha256 digests, so building the remote git context on Apple Silicon produces x86-64 binaries (piguard-server, libonnxruntime.so) inside an arm64-labeled image and the container crash-loops with "rosetta error: failed to open elf at /lib64/ld-linux-x86-64.so.2". Vendor the daemon build in docker/piguard-daemon/Dockerfile: it compiles the pinned upstream v1.0.0 source (git clone --branch v1.0.0) with unpinned base image tags, which resolve to the host architecture. The upstream Makefile is arch-aware and selects the aarch64 ONNX Runtime when GOARCH=arm64, so the resulting image contains native binaries (verified: ELF e_machine b7 = EM_AARCH64 for both the server binary and libonnxruntime.so; container reaches healthy and correctly labels BENIGN/INJECTION through the gateway). This replaces the manual Apple Silicon workaround documented in PR #85.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
odek | d984eaf | Commit Preview URL Branch Preview URL |
Jul 22 2026, 08:01 AM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
The
piguardservice indocker/docker-compose.ymlbuilds from the remote git contexthttps://github.com/BackendStack21/go-prompt-injection-guard.git#v1.0.0. The upstream Dockerfile pins its base images by amd64-only sha256 digests (golang:1.26-bookworm@sha256:483d...,debian:bookworm-slim@sha256:0104...). On Apple Silicon Macs the build therefore produces x86-64 binaries (piguard-server,libonnxruntime.so) inside an arm64-labeled image, and the container crash-loops with:Fix
Vendor the daemon build in
docker/piguard-daemon/Dockerfile:git clone --depth 1 --branch v1.0.0), so we still track the v1.0.0 release exactly.golang:1.26-bookworm,debian:bookworm-slim), which resolve to the host architecture. The upstream Makefile is arch-aware (it selects the aarch64 ONNX Runtime whenGOARCH=arm64), so the resulting image contains native binaries. Note: the upstream Makefile has no checksum entries for linux-arm64, so it prints WARNINGs during the build — expected and harmless./usr/local/bin,libonnxruntime.soat/usr/local/lib,ORT_DYLIB_PATHenv, non-rootpiguarduid 10001,/run/piguard+/modelsdirs,ENTRYPOINT ["piguard-server"].docker-compose.ymlnow buildscontext: ./piguard-daemonand the manual Apple Silicon workaround comment from #85 is replaced by a short note explaining the vendored build.Verification (arm64 Mac, Docker Desktop)
ELF e_machine header check (offset 18;
b7= EM_AARCH64,3e= x86-64):docker compose --profile restricted up -d piguard piguard-gateway→docker-piguard-1reacheshealthy(socket healthcheck), no rosetta crash.Detection through the vendored gateway:
Stack torn down cleanly with
docker compose --profile restricted down.