# unikraft build

Build a Unikraft project into a container image.

```
unikraft build [<input>] [flags]
```

## Examples

Build the project in the current directory:

```bash
unikraft build .
```

Build and publish an image from a Kraftfile:

```bash
unikraft build . --output my-org/my-app:latest
```

Build with custom build arguments:

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

Build with secret and SSH access:

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

Build and save to a local OCI archive:

```bash
unikraft build . --output ./dist/my-app.oci.tar
```

## Options

```
  --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.
  --no-cache                  Do not use cache when building the image.
  -o, --output OUTPUT         Output destination
  --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

```
  --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 anonymous usage analytics. (default true)
```

## See Also

* [`unikraft`](../unikraft.mdx): The Unikraft Command-Line Interface.

