Hi,
The current Dockerfile works, but pip install ./bindings/python recompiles the C++ extension inside the final image, which means the runtime image carries the whole toolchain (g++, cmake, python3-dev). I'd like to split it into a real multi-stage build: a builder that produces a wheel, and a slim runtime that just installs it. Should bring the image size down meaningfully.
While I'm at it, a few smaller cleanups I'd bundle in or skip depending on your preference:
- Bump the base to
ubuntu:24.04 LTS (22.04 still works, just buys ~2 more years of support).
- Run as a non-root user: mostly so files written to mounted volumes don't end up owned by root on the host.
- BuildKit cache mounts for apt/pip: mainly speeds up CI rebuilds.
A couple of questions before I open a PR:
- The non-root switch slightly changes how mounted volumes behave. OK with you?
tools/devops/Dockerfile.base and Dockerfile.multistage look like older WIP attempts (their readme even points to a wrong path). Leave them, clean up here, or separate PR?
Happy to drop any of the secondary items if you'd rather keep the change minimal.
Thanks!
Hi,
The current
Dockerfileworks, butpip install ./bindings/pythonrecompiles the C++ extension inside the final image, which means the runtime image carries the whole toolchain (g++, cmake, python3-dev). I'd like to split it into a real multi-stage build: a builder that produces a wheel, and a slim runtime that just installs it. Should bring the image size down meaningfully.While I'm at it, a few smaller cleanups I'd bundle in or skip depending on your preference:
ubuntu:24.04LTS (22.04 still works, just buys ~2 more years of support).A couple of questions before I open a PR:
tools/devops/Dockerfile.baseandDockerfile.multistagelook like older WIP attempts (their readme even points to a wrong path). Leave them, clean up here, or separate PR?Happy to drop any of the secondary items if you'd rather keep the change minimal.
Thanks!