Proposal: mise oci build --copy HOST_PATH:IMAGE_PATH for baking arbitrary host paths as reproducible layers #10934
Replies: 2 comments
-
|
Thanks for the detailed proposal. I implemented this in #10952 with the |
Beta Was this translation helpful? Give feedback.
-
|
wow that was quick. this looks great, thanks. should be useful for a lot of cases - i'll test it out and let you know, in case i find anything also, maybe worth commenting on action rust cache issue - that this honestly a better path than action - maybe once oci comes out of beta. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What's missing
mise oci buildcan bake tools, apt packages, and dotfiles into an image, but there is no way to place an arbitrary host file or directory at a chosen path in the image. Today the only escape hatch is to drop out to a Dockerfile wrapper (COPY) after the build, which leaves mise's reproducible layer machinery behind and reintroduces the non determinism that mise's OCI layers are designed to avoid.Proposal
Add a repeatable flag, and a matching
[[oci.copy]]config table:hostis a path on the build host (file or directory).imageis an absolute path in the resulting image.Behavior
statthe host path locally to decide file vs directory. Its content lands at the image path. Create parent directories in the image if they do not already exist.build_layer_from_dir(directory) or the single file path. This is the same symlink preserving emitter already used for tool layers, so it is deterministic out of the box: mtimes zeroed, owner normalized via--owner, executable bits preserved (0o755/0o644).dev.mise.copyplus the target path) so it is inspectable viaskopeo inspect.Why this fits the existing design
The layer emitter already exists and is hardened for reproducibility; this only exposes it for host paths that are not part of a tool install. The flag surface matches the current
oci buildflags (--from,--output,--owner,--tag,--mount-point,--no-mise). The[[oci.copy]]table mirrors the flag and is consistent with[oci]already carrying array fields (entrypoint,cmd).Use cases
The intent here is a general, future looking primitive, not a Rust fix.
mise oci buildpositions itself as a reproducible alternative to a Dockerfile, yet it has no equivalent of the single most common Dockerfile instruction,COPY. A generic copy serves a broad set of needs, for example:That last category is where I hit the gap concretely. With Rust, the toolchain lives under
RUSTUP_HOME(toolchains/<tc>/), outsideinstalls/rust/<version>/, so amise oci buildimage has the cargo proxy shims but not the toolchain behind them. A generic copy lets the caller bake such payloads into the image at known paths and point the relevant env at them, with no tool specific logic in mise. Solving it generically keeps that special case out of mise core and covers the other use cases at the same time.Open questions for direction before I open a PR
host/image, or something more explicit likehost_path/image_path?{{ }}or env interpolation, for dynamic host paths (versioned payloads produced in CI)?Closing
@jdx this one is more involved and more debatable than my last change, and it defines a new seam for
ociat the layer emitter level, so I would rather not assume the shape. I would appreciate your comments or suggestions. If it sounds reasonable as proposed, I am happy to raise the PR. Even just a steer on flag plus[[oci.copy]]vs a different surface would be enough for me to proceed. Does that work?Beta Was this translation helpful? Give feedback.
All reactions