跳转到内容

mise oci build ​

[实验性] 根据当前的 mise.toml 构建一个 OCI 镜像

Each tool version becomes its own content-addressable OCI layer. Bumping a tool version invalidates that tool's layer (a Python bump also invalidates pypi tool layers, which are relocated against it); other tool layers and the base image layers are reused, while the generated /etc/mise/config.toml layer, image config, and manifest are regenerated. The output directory follows the OCI image-layout spec.

Only tools from project config files are packaged, including a monorepo root's config. The global and system configs and a config directly in your home directory, such as ~/mise.toml, are left out unless you pass --include-global.

Build on a Linux host with the image's architecture. Tools are packaged as installed on the host, and so is the running mise binary, at /usr/local/bin/mise, unless you pass --no-mise. asdf plugins are not supported; use a vfox plugin or any other backend for each tool. vfox plugins are copied into the image next to the tools they install.

需要 mise settings experimental=true(或 MISE_EXPERIMENTAL=1)。

标志 ​

  • --copy <HOST_PATH:IMAGE_PATH> — 将主机文件、目录或符号链接复制到镜像中(可重复,HOST:IMAGE)

  • -o --output <OUTPUT> — OCI 镜像布局的输出目录

    Default: ./mise-oci

  • --from <FROM> — Base image reference (overrides [oci].from and the oci.default_from setting)

  • --include-global — Also package tools from the global and system configs

    By default mise oci build packages only project config files, including a monorepo root's config. With this flag it also includes the tools, [oci], [bootstrap.packages], and [dotfiles] of the global and system configs and of a config directly in your home directory, so personal tools from ~/.config/mise/config.toml end up in the image.

  • -t --tag <TAG> — Tag to record in the image index (the org.opencontainers.image.ref.name annotation)

  • --mount-point <MOUNT_POINT> — Where tools install inside the image

    Overrides [oci].mount_point and the oci.default_mount_point setting.

  • --no-mise — Do not embed the currently-running mise binary at /usr/local/bin/mise

  • --no-cache — Rebuild tool layers without reading or writing the local layer cache

  • --owner <UID[:GID]> — UID[:GID] to assign to every tar entry in generated layers

    Overrides [oci].user_id and [oci].group_id. Defaults to 0:0. If GID is omitted, it defaults to UID. This affects file ownership only; [oci].user controls the image USER directive.

  • -h --help — Print help

示例 ​

Build the project's image into ./mise-oci

mise oci build

Use another base image and record a tag

mise oci build --from ubuntu:24.04 --tag myorg/dev:latest -o ./img

Inspect the result

skopeo inspect oci:./img

Open a shell in it

mise oci run --image-dir ./img -- /bin/sh

相关文档 ​