They’re not official, but you might have better luck using the cibuilds/snapcraft images. It provides core16 and core18 tags: the idea being to pick the one that matches your project’s base snap. So your job might be simplified to:
Note that there are limitations to this method: as snapd does not function within a Docker container, this won’t work to build projects that make use of the build-snaps feature to install snaps on the build machine.
I’m also maintaining Container Images in Docker Hub. You might find mine are more suitable if you need to build for other architectures than amd64, or core20: https://hub.docker.com/r/diddledan/snapcraft
I’m guessing it needs an update though (seems to hardcode “16”, as in 16.04), to make it work with Ubuntu 20.04, cause after trying it I get the error:
/snap/bin/snapcraft: 3: exec: /snap/snapcraft/current/usr/bin/python3: not found
If anyone wants to know the exact bits of the build:
My app is not proprietary so I might give this a go in case it’s better than using GitHubActions (which is what I ended up using instead of GitLabCI, FTR).