Split onnxruntime and numpy into their own image layers #50

Merged
svc-agent-writer merged 1 commit from fix/image-layers into main 2026-10-31 13:41:40 +00:00

Summary

The 0.4.0 image did not push. podman push failed with 413 Payload Too Large from the proxy in front of git.groupthink.asia.

  • The venv layer is 111.9 MB compressed. In 0.3.0 it was 51.3 MB, before onnxruntime and numpy.
  • A layer is pushed in one request, and the proxy refuses a request over 100 MB. That matches Cloudflare's limit.

The fix is in the Containerfile:

  • The builder stage moves onnxruntime, numpy and numpy.libs out of the venv.
  • The runtime stage copies them back as two layers of their own.
Layer Before (MB, gzip) After (MB, gzip)
venv 111.9 64.2
onnxruntime (in venv) 26.5
numpy + numpy.libs (in venv) 21.3
model 29.8 29.8

The image content is unchanged: the same files at the same paths.

Test plan

  • make image-amd64 builds.
  • In the amd64 image, numpy 2.5.4 and onnxruntime 1.31.1 import, and the model embeds two strings with a cosine of 0.689, the same as before the split.

🤖 Generated with Claude Code

## Summary The 0.4.0 image did not push. `podman push` failed with `413 Payload Too Large` from the proxy in front of `git.groupthink.asia`. - The venv layer is 111.9 MB compressed. In 0.3.0 it was 51.3 MB, before onnxruntime and numpy. - A layer is pushed in one request, and the proxy refuses a request over 100 MB. That matches Cloudflare's limit. The fix is in the `Containerfile`: - The builder stage moves `onnxruntime`, `numpy` and `numpy.libs` out of the venv. - The runtime stage copies them back as two layers of their own. | Layer | Before (MB, gzip) | After (MB, gzip) | |---|---|---| | venv | 111.9 | 64.2 | | onnxruntime | (in venv) | 26.5 | | numpy + numpy.libs | (in venv) | 21.3 | | model | 29.8 | 29.8 | The image content is unchanged: the same files at the same paths. ## Test plan - `make image-amd64` builds. - In the amd64 image, numpy 2.5.4 and onnxruntime 1.31.1 import, and the model embeds two strings with a cosine of 0.689, the same as before the split. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The registry's proxy refuses a request over 100 MB, and the 0.4.0 venv layer is 111.9 MB compressed, so the push failed with 413. Moving the two largest packages into layers of their own keeps every layer under 65 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No description provided.