Hello, I am trying to package a very basic snap with two files in the source. One is an executable that hosts a webserver and the other is an html file.
When I run the executable outside of a snap, it works great and it can find the html file so long as it is in the same directory as the html file. However, when I install it as a snap and run it, it cannot find the html file anymore, even though both the executable file and the html file are stored in /snap/go-webserver/current.
Even when I install the snap and manually run the executable from the /snap/go-webserver/current directory using “./main” it works great. Also, when I make the snap containment classic, it works great. However, I cannot use classic containment because I am going to put this snap on an Ubuntu-Core image.
I tried adding plugs that gave the snap access to the $SNAP directory but that didn’t seem to change anything. Here is my current snapcraft.yaml
name: go-webserver
summary: Lightweight webserver to display a basic html file
description: |
Created to display a basic loading html file until the PLC has started.
version: test
base: core22
confinement: strict
grade: stable
type: app
plugs:
dot-config-go-webserver:
interface: content
content: binaries
target: $SNAP/
apps:
go-webserver:
command: main
plugs:
- home
- browser-support
- network
- network-bind
- dot-config-go-webserver
daemon: simple
restart-condition: always
parts:
go-webserver:
plugin: dump
build-snaps: [go/latest/stable]
source: ./build
Any help would be greatly appreciated.