The snapcraft.yaml schema

The snapcraft.yaml file is the main entry point to create a snap through Snapcraft. It contains all the details the snapcraft command needs to build a snap.

:information_source: See Snapcraft checklist for an overview of the typical project details needed before creating snapcraft.yaml.

In general, snapcraft.yaml can be organised into three main sections:

1. top-level metadata, containing values, such as name, typically used by the store:

name: hello
base: core22
version: '2.10'
summary: GNU Hello, the "hello world" snap
description: |
  GNU hello prints a friendly greeting.
grade: stable
confinement: strict

2. apps detailing how apps and services are exposed to the host system:

    command: bin/hello

3. and parts to describes how to import, and potentially build, each required part of the snap:

    plugin: autotools

For further details on the metadata contained within each of the above sections, see one of the following:

  1. Snapcraft top-level metadata
  2. Snapcraft app and service metadata
  3. Snapcraft parts metadata

A set of environment variables is also available during the build process. See Environment variables that Snapcraft exposes for further details.

Additionally, see Snapcraft.yaml reference for a complete overview of the metadata supported by snapcraft.yaml, and Snapcraft advanced grammar to learn how to check for specific conditions for certain YAML keys.

Last updated 4 months ago.