Snapcraft can optionally use the following arguments to modify the build environment.
Snapcraft Argument | Description | Notes |
|---|---|---|
| Destructive mode. Designed to be used in scenarios where additionalprovisioning of the build environment is required. This is not recommendedbecause the buildcould contaminate the host build environment. | Seedestructive mode. |
| Builds the snap usingLXDrather than Multipass. This can potentially reduce resource usage, especiallyfrom a VM. | Requires LXD. For more information, seeSelect a build provider. |
| Configures HTTP proxy. Snapcraft will honor the | None. |
| Configures HTTPS proxy. Snapcraft will honor the | None. |
| Bind the | Requires LXD or Multipass. Only available when building core22 snaps. |
| Configure the build environment with ESM using specified UA token. | Requires LXD or Multipass. Only works for snaps built on core22. |
| Add the build manifest to the snap package in | Snaps built on Launchpad will have this setautomatically. For snaps newer than core22, the command-line flag is deprecatedand removed. The environment variable will still work. |
Destructive mode builds the snap directly on the machine where Snapcraft is run withoutlaunching a build container. It is not recommended to use this option because Snapcraftcannot control the build environment. It is especially not recommended to use a personalmachine or in a shared environment, where operations like adding package repositoriesmay be disruptive.
The build environment should match the snap base. For example, a core24 snap should bebuilt inside of an Ubuntu 24.04 environment.
For core22 and newer snaps, the user must have root-level permissions so that they cando operations such as installing snaps and apt packages and adding package repositorieswithout needing to use sudo.
While destructive mode can be used in CI to save time, using an OCI image or a LXDcontainer is recommended. Seesnapcraft rocks for OCI images that can be used withDocker to build snaps. For projects in GitHub, theaction-build workflow is a good option.