LXD containers that don't live on the same host currently can't be used with snapcraft's new containerized mode. The project folder is mounted using a LXC device which only deals with folders that exist on the server.
To solve this, we need to use sshfs to make the project folder available via an SSH connection. Slave mode can be used to reverse mount the folder into the container - that's what we need since we assume that containers can be discarded at any time and shouldn't store any important data. This way the client running snapcraft only needs to spawn an sftp-server as a user, with no need for sshd. We can easily connect to the container by pushing a generated key.
The branch has finally landed, this was not an easy beast to tame
Note: the final implementation doesn’t use SSH anymore but only relies on the LXD connection so that containers don’t need to be in the same network as snapcraft.