[AAASM-3527] 🐛 (aa-runtime): Fix Docker image entrypoint (/aa-runtime was a directory)#1198
Conversation
The build context (context: .) `COPY . .` brings the repo's aa-runtime/ source dir into /app as /app/aa-runtime. The builder then `cp`d the built binary to /app/aa-runtime, which landed *inside* that pre-existing directory as /app/aa-runtime/aa-runtime. The final stage COPYd that directory to /aa-runtime, so ENTRYPOINT ["/aa-runtime"] resolved to a directory and the sidecar failed at startup with `exec /aa-runtime: is a directory`. Copy the binary to /aa-runtime-bin (outside /app), a path no source dir can shadow, and COPY that single file into the final image. The entrypoint is now the executable binary. Closes AAASM-3527 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The aa-runtime image builds with context: . (repo root). Exclude target/, VCS, and node_modules from the context so a host-built (wrong-arch, non-musl) artifact can never be pulled in and the context stays small. Defense in depth against the source-dir/binary name collision fixed in the prior commit. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🤖 Claude Code — PR review (record)CI: ✅ all green (Analyze rust/python/js-ts, Build language images, CodeQL). Scope vs AAASM-3527: ✅ fully covers it. Root cause correctly identified — Verdict: ✅ Ready to approve & merge. |
Description
aa-runtime/Dockerfileproduced an image whoseENTRYPOINT ["/aa-runtime"]resolved to a directory instead of the binary, so the published sidecar could not start:Root cause. The image builds with
context: .(repo root).COPY . .brings the repo'saa-runtime/source directory into the builder as/app/aa-runtime. The builder step then rancp target/$TARGET/release/aa-runtime /app/aa-runtime— but/app/aa-runtimealready existed as a directory, so the binary was placed inside it as/app/aa-runtime/aa-runtime. The final stage'sCOPY --from=builder /app/aa-runtime /aa-runtimetherefore copied that directory into the runtime image, and the entrypoint pointed at a directory.Fix. Copy the built binary to
/aa-runtime-bin(outside/app), a path that no source directory in the build context can shadow, andCOPYthat single file into the final image. Also added a root.dockerignore(excludestarget/,.git/,.github/,node_modules/) as defense-in-depth so the context stays lean and a host-built artifact can never be pulled in.Before / after evidence
Built
docker build -f aa-runtime/Dockerfile -t aa-runtime-test .from the repo root, then inspected the final image filesystem (distroless, no shell) viadocker export:The
/aa-runtimeentry is now a regular executable file (-rwxr-xr-x, 9.3 MB) — before the fix it was a directory (d...).Running the container executes the binary (no
is a directory):The runtime reaches its own
main.rsconfig-loading logic, proving the entrypoint is the executable.Type of Change
Breaking Changes
Related Issues
Closes AAASM-3527
Testing
docker build+ filesystem inspection + container start, see evidence above)Checklist