By default, Snapcraft uses Multipass to simplify the build process and to confine the build environment within a virtual machine. For most developers, this happens transparently and is the best way to build snaps.
But to cater for different operating systems, environments and requirements, Snapcraft also offers a number of flexible options for how it can be run. These are outlined below.
Command | Description | Requirements |
---|---|---|
snapcraft default |
Multipass. Builds the snap within an instantiated VM to ensure a clean, isolated, build environment. Nested VMs require accelerated/nested VM functionality. | Any supported Linux system with VM capabilities. Windows/macOS support coming soon. |
snapcraft --destructive-mode |
Destructive mode. Designed to be used in temporary/short-lived environments, such as on a CI system, because the build could contaminate the host build environment. | Needs access to Ubuntu 18.04 (core18) or 16.04 (core16 / core), alongside snapcraft, from the Snap Store. |
snapcraft --http-proxy <http-proxy> |
Configures HTTP proxy. Snapcraft will honour http_proxy environment flag as well. |
None |
snapcraft --https-proxy <https-proxy> |
Configures HTTPS proxy. Snapcraft will honour https_proxy environment flag as well. |
None |
snapcraft --add-ca-certificates <path> |
Adds trusted CAs in Snapcraft-created build environments. May be a CA certificate file or directory containing certificate files. | LXD, Multipass |
electron-builder -l snap |
Electron builder integration. Enables Electron app developers to easily create snaps with a simple modification to package.json . |
Requires Election-builder with Linux or macOS snapcraft from the Snap Store or brew. |
Command | Description | Requirements |
---|---|---|
snapcraft remote-build |
Remote build. Runs a multi-architecture build process on remote servers using Launchpad. | Prospective snaps need to be open source as the code will be publicly available, plus a Launchpad account. |
snapcraft --use-lxd |
LXD container. Builds the snap using LXD, rather than Multipass, to potentially reduce resource usage, especially from a VM. | Needs LXD and a supported Linux system with snapcraft from Snap Store. |
Command | Description | Requirements |
---|---|---|
snapcraft cleanbuild |
Cleanbuild. Legacy non-bases method for building snaps in a LXD container. | Deprecated with the release of Snapcraft 3.x and no longer supported. |
apt install snapcraft |
Snapcraft deb package. Originally used to install snapcraft on Ubuntu-based Linux distributions (and Debian). | Outdated and no longer supported. See Snapcraft overview for current installation instructions. |
A supported Linux system is a host or VM running a snap-capable Linux distribution. See Installing snapd for details.
Last updated 2 months ago. Help improve this document in the forum.