Skip to content

app.yaml reference

app.yaml tells Space CLI how to build one application from source. The build produces an OCI artifact and an artifact manifest. A build.yaml composition can then refer to a named output from that manifest.

Examples

MirageOS

schema: space.app
version: "1"
name: mirage-hello
source: .
kind: mirage
mirage_version: "4.9.0"
ocaml_version: "5.4.1"
opam_repo: https://github.com/ocaml/opam-repository.git
opam_repo_rev: "<full-git-commit>"
targets:
- platform: hvt
arch: arm64
- platform: hvt
arch: amd64
policy:
network: replay
reproducible: true
outputs:
flight:
platform: hvt
path: dist/http-fetch.hvt
kind: unikernel

Unikraft

schema: space.app
version: "1"
name: unikraft-hello
source: .
kind: unikraft
kraftkit_image: kraftkit.sh/base@sha256:<digest>
targets:
- platform: qemu
arch: arm64
- platform: qemu
arch: amd64
policy:
network: replay
reproducible: true
outputs:
flight:
platform: qemu
path: .unikraft/build/app_qemu
kind: unikernel

OCI image

schema: space.app
version: "1"
name: cloud-mask
source: .
kind: oci
dockerfile: Dockerfile
context: .
targets:
- platform: linux
arch: arm64
- platform: linux
arch: amd64
policy:
network: replay
reproducible: true
outputs:
service:
kind: oci

Common fields

FieldTypeRequiredDescription
schemastringyesMust be space.app.
versionstringyesSchema version. The current version is "1".
namestringyesApplication name written to the artifact manifest.
sourcepathyesSource tree. Relative paths start at the manifest directory.
kindmirage, unikraft, or ociyesBuild lane used to prepare the source.
targets[]listyesPlatform and CPU variants to build.
policymapyesNetwork and reproducibility settings for the build.
cache[]listnoNamed, content-addressed inputs available to an offline build.
outputsmapyesNamed outputs published in the artifact manifest.

Target fields

FieldTypeRequiredDescription
targets[].platformstringyesRuntime platform, such as hvt, qemu, or linux.
targets[].archstringyesCPU architecture, such as arm64 or amd64.
targets[].optionsmapnoLane-specific build options for this variant.
targets[].imageOCI referencenoPinned toolchain or base image for this variant.

Each output name is independent of CPU architecture. Space CLI publishes the variants under one OCI index, so build.yaml refers to app-name#output-name.

MirageOS fields

FieldTypeRequiredDescription
mirage_versionstringyesMirageOS release used to configure the application.
ocaml_versionstringyesOCaml compiler version.
opam_repoURLyesOpam repository used to solve dependencies.
opam_repo_revGit commityesFull commit that pins the opam repository.

Unikraft fields

FieldTypeRequiredDescription
kraftkit_imageOCI reference with digestyesPinned KraftKit build image.

OCI fields

FieldTypeRequiredDescription
dockerfilepathyesDockerfile relative to the manifest directory.
contextpathyesComplete Docker build context.

Build policy

ValuePrepare phaseBuild phaseUse
allownetwork allowednetwork allowedResolve and build mutable inputs.
noneofflineofflineBuild from inputs already present.
replayofflineofflineRebuild from verified cache inputs.

Set policy.reproducible to true to require an offline build and compare the output of two builds by digest.

Each cache entry has a name, a seed mode, and a digest. Space CLI checks the digest before mounting the cache. The build record lists every cache input and base image used to produce the result.

Output fields

FieldTypeRequiredDescription
outputs.<name>.kindunikernel or ociyesType of the published output.
outputs.<name>.platformstringrequired for unikernelsRuntime platform for the output.
outputs.<name>.pathpathrequired for unikernelsBuilt file to place in the OCI artifact.

Run the build from the application directory:

Terminal window
space build app.yaml

The build writes the OCI index, software bill of materials, provenance, and artifact manifest under _build/oci/<name>/.