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.
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 principle sections:
1. top-level metadata, containing values, such as name, typically used by the store:
name: hello base: core18 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:
apps: hello: command: bin/hello
3. and parts to describes how to import, and potentially build, each required part of the snap:
parts: gnu-hello: source: http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz plugin: autotools
For further details on the metadata contained within each of the above sections, see one of the following:
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.
As the last resort, you may go ahead and check out the schema in the Sanpcraft source tree: snapcraft/snapcraft.json at master · snapcore/snapcraft.
Last updated 4 months ago. Help improve this document in the forum.