Zudoku
unikraft

unikraft build

Build a Unikraft project into a container image.

Code
unikraft build [<input>] [flags]

Examples

Build the project in the current directory:

TerminalCode
unikraft build .

Build and publish an image from a Kraftfile:

TerminalCode
unikraft build . --output my-org/my-app:latest

Build from a Dockerfile without a Kraftfile:

TerminalCode
unikraft build ./Dockerfile --arch x86_64 --output my-org/my-app:latest

Build with custom build arguments:

TerminalCode
unikraft build ./app --build-arg VERSION=1.2.3 --build-arg COMMIT=abc123

Build with secret and SSH access:

TerminalCode
unikraft build . --secret id=npm,src=$HOME/.npmrc --ssh default=$SSH_AUTH_SOCK

Build for arm64 and publish the image:

TerminalCode
unikraft build . --arch arm64 --output my-org/my-app:latest

Build and save to a local OCI archive:

TerminalCode
unikraft build . --output ./dist/my-app.oci.tar

Options

Code
--arch ARCH Only build the Kraftfile targets of these architectures. Defaults to every declared target, or x86_64 when only a runtime is declared. Required when the project declares no targets and no runtime, such as a bare Dockerfile. --build-arg BUILD-ARG Set build-time variables. --insecure INSECURE Allow insecure (HTTP/unverified TLS) connections to registries. Specify hostnames to restrict, or omit to apply to all. --metro metro Metros that a remote build may run in, by name or API URL. Defaults to the build service's choice. --no-cache Do not use cache when building the image. -o, --output OUTPUT Output destination --remote url Build on the build service at this URL and push the image from there, instead of building locally. Defaults to the build_url of the profile, or https://controlplane.unikraft.com. Creates a builder with the default sizes if you have none. To set the sizes, use 'unikraft builder create'. --secret SECRET Secret to expose to the build (format: "id=mysecret[,src=/local/secret]"). --ssh SSH SSH agent socket or keys to expose to the build (format: "default|<id>[=<socket>|<key>[,<key>]]").

Options inherited from parent commands

Code
--config file Path to the configuration file. --log-level level Set the logging level. (default info) --log-type type Set the log type. (default text) --profile name Set the current profile. --telemetry Toggle usage analytics. (default true) --timeout duration Set a deadline for the command (e.g. 30s, 5m, 1h).

See Also

  • unikraft: The Unikraft Cloud CLI: run any Dockerfile as a microVM that cold-starts in milliseconds.
Last modified on