Building a snap with snapcraft.yaml
Closed this issue · 3 comments
I have been trying to create a snap for 2 weeks now, but it still doesn't work
Today I managed to finally make the app run and load HTML in the webview, but the Blazor won't load.
All I see is the HTML / CSS loader spinner that spins indefinitely
Do you know how to make it work?
Below are the snapcraft.yaml and the console output
name: openhabittracker
version: '1.0.0'
grade: devel
summary: Take notes, plan tasks, track habits
description: |
- Free and Ad-Free
- Open Source
- Privacy Focused: All user data is stored locally on your device
- Available on Windows, Linux, Android, iOS, macOS, and as a web app
- Localized to English, German, Spanish, Slovenian
Key Features:
- Markdown support for notes
- Use categories and priorities to organize your notes, tasks, and habits
- Advanced Search, Filter, and Sort
- Data Export/Import: JSON, YAML, TSV, Markdown
- Import your notes from Google Keep
- Available in 26 themes with Dark and Light modes
base: core22
confinement: devmode
layout:
/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/webkit2gtk-4.0:
bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/webkit2gtk-4.0
# /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/webkit2gtk-4.1:
# bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/webkit2gtk-4.1
parts:
openhabittracker:
plugin: dotnet
dotnet-build-configuration: Release
dotnet-self-contained-runtime-identifier: linux-x64
source: .
override-build: |
dotnet build OpenHabitTracker.Blazor.Photino/OpenHabitTracker.Blazor.Photino.csproj -c Release
dotnet publish OpenHabitTracker.Blazor.Photino/OpenHabitTracker.Blazor.Photino.csproj -r linux-x64 -c Release -p:PublishSingleFile=true --self-contained true -f net8.0 -o $SNAPCRAFT_PART_INSTALL
chmod 0755 $SNAPCRAFT_PART_INSTALL/OpenHT
build-packages:
#- libwebkit2gtk-4.1-dev
- dotnet-sdk-8.0
stage-packages:
#- libwebkit2gtk-4.1-0
- libwebkit2gtk-4.0-37
- libnotify4
- libicu70
- libglu1-mesa
- freeglut3
- libwebkit2gtk-4.0-dev
- webkit2gtk-driver
- libcanberra-gtk3-module
- libcanberra-gtk-module
- libgl1-mesa-dri
- mesa-vulkan-drivers
- libgbm1
- libglx-mesa0
apps:
openhabittracker:
command: OpenHT
plugs:
- opengl
- hardware-observe
environment:
LIBGL_DRIVERS_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/dri
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/dri
console:
urban@urban-VirtualBox:~/Jinjinov/OpenHabitTracker$ snap run openhabittracker
Photino.NET: "Photino".SetTitle(Photino.Blazor App)
Photino.NET: "Photino.Blazor App".SetUseOsDefaultSize(False)
Photino.NET: "Photino.Blazor App".SetUseOsDefaultLocation(False)
Photino.NET: "Photino.Blazor App".SetWidth(1000)
Photino.NET: "Photino.Blazor App".SetHeight(900)
Photino.NET: "Photino.Blazor App".SetLeft(0)
Photino.NET: "Photino.Blazor App".SetTop(100)
Photino.NET: "Photino.Blazor App".SetTitle(OpenHabitTracker)
Photino.NET: "OpenHabitTracker".SetUseOsDefaultSize(False)
Photino.NET: "OpenHabitTracker".SetSize(1680, 1050)
Photino.NET: "OpenHabitTracker".SetUseOsDefaultLocation(False)
Photino.NET: "OpenHabitTracker".SetTop(0)
Photino.NET: "OpenHabitTracker".SetLeft(450)
Photino.NET: "OpenHabitTracker".Load(/)
Photino.NET: "OpenHabitTracker" ** File "/" could not be found.
Photino.NET: "OpenHabitTracker".Load(app://localhost/)
Gtk-Message: 08:19:04.503: Failed to load module "canberra-gtk-module"
Gtk-Message: 08:19:04.508: Failed to load module "canberra-gtk-module"
Gtk-Message: 08:19:05.301: Failed to load module "canberra-gtk-module"
Gtk-Message: 08:19:05.302: Failed to load module "canberra-gtk-module"
VMware: No 3D enabled (0, Success).
VMware: No 3D enabled (0, Success).
Photino.NET: "OpenHabitTracker".SendWebMessage(__bwv:["BeginInvokeJS",2,"Blazor._internal.attachWebRendererInterop","[3,{\u0022__dotNetObject\u0022:1},{},{}]",3,0])
Photino.NET: "OpenHabitTracker".SendWebMessage(__bwv:["AttachToDocument",0,"app"])
Photino.NET: "OpenHabitTracker".SendWebMessage(__bwv:["BeginInvokeJS",3,"import","[\u0022./_content/OpenHabitTracker.Blazor/jsInterop.js\u0022]",1,0])
Photino.NET: "OpenHabitTracker".SendWebMessage(__bwv:["RenderBatch",1,"AAAAAAEAAAABAAAAAAAAAAAAAAD/////AQAAAAEAAAABAAAAAAAAAAUAAAD/////AgAAAAEAAAABAAAAAAAAAAgAAAD/////AwAAAAEAAAABAAAAAAAAAAsAAAD/////BAAAAAMAAAABAAAAAAAAAA0AAAD/////AQAAAAEAAAAnAAAA/////wEAAAACAAAAKAAAAP////8FAAAAAQAAAAEAAAAAAAAAKQAAAP////8GAAAAAQAAAAEAAAAAAAAALwAAAP////8HAAAAAQAAAAEAAAAAAAAANQAAAP////8IAAAAAAAAABgAAAAwAAAASAAAAGAAAACYAAAAsAAAAMgAAAA7AAAABAAAAAUAAAABAAAAAAAAAAAAAAADAAAAAAAAAP////8AAAAAAAAAAAMAAAABAAAA/////wAAAAAAAAAAAwAAAAIAAAD/////AAAAAAAAAAADAAAAAwAAAP////8AAAAAAAAAAAQAAAADAAAAAgAAAAAAAAAAAAAAAwAAAAQAAAD/////AAAAAAAAAAADAAAABQAAAP////8AAAAAAAAAAAQAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAYAAAD/////AAAAAAAAAAADAAAABwAAAP////8AAAAAAAAAAAQAAAACAAAABAAAAAAAAAAAAAAAAwAAAAgAAAD/////AAAAAAAAAAABAAAAGgAAAAkAAAAAAAAAAAAAAAMAAAAKAAAACwAAAAAAAAAAAAAAAQAAABgAAAAJAAAAAAAAAAAAAAADAAAACgAAAAwAAAAAAAAAAAAAAAEAAAAWAAAACQAAAAAAAAAAAAAAAwAAAAoAAAANAAAAAAAAAAAAAAABAAAABQAAAA4AAAAAAAAAAAAAAAMAAAAKAAAADwAAAAAAAAAAAAAAAwAAABAAAAD/////AQAAAAAAAAAIAAAAEQAAAAAAAAAAAA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A7QYAAAUHAAAKBwAAEAcAAB4HAAA2BwAAPAcAAEoHAABiBwAAaQcAAGwHAAD5BwAA\u002BwcAAAEIAAAZCAAAOggAAEAIAABGCAAAXggAAIQIAACKCAAAkQgAAKkIAADKCAAA4AAAAAQBAACkBQAAqAUAANEIAAA="])
Photino.NET: "OpenHabitTracker".SendWebMessage(__bwv:["AttachToDocument",8,"head::after"])
Photino.NET: "OpenHabitTracker".SendWebMessage(__bwv:["RenderBatch",2,"CAAAAAIAAAABAAAAAAAAAAAAAAD/////AQAAAAEAAAACAAAA/////wkAAAABAAAAAQAAAAAAAAAEAAAA/////wkAAAAAAAAACgAAAAEAAAABAAAAAAAAAAYAAAD/////CgAAAAAAAAALAAAAAAAAAAsAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAkAAAAAAAAAKAAAAEAAAABIAAAAYAAAAGgAAABwAAAAeAAAAIAAAAAIAAAABAAAAAIAAAAJAAAAAAAAAAAAAAADAAAAAAAAAP////8AAAAAAAAAAAQAAAACAAAACgAAAAAAAAAAAAAAAwAAAAAAAAD/////AAAAAAAAAAAEAAAAAgAAAAsAAAAAAAAAAAAAAAMAAAABAAAA/////wAAAAAAAAAABAAAAAIAAAAMAAAAAAAAAAAAAAADAAAAAQAAAP////8AAAAAAAAAAAAAAAAAAAAACVNlY3Rpb25JZAdjb250ZW50XAEAAGYBAACIAAAAsAAAAFQBAABYAQAAbgEAAA=="])
urban@urban-VirtualBox:~/Jinjinov/OpenHabitTracker$
I made some progress. Now the app loads from Snap, but a File open dialog crashes the app.
name: openhabittracker
version: '1.0.0'
grade: stable #devel
summary: Take notes, plan tasks, track habits
description: |
- Free and Ad-Free
- Open Source
- Privacy Focused: All user data is stored locally on your device
- Available on Windows, Linux, Android, iOS, macOS, and as a web app
- Localized to English, German, Spanish, Slovenian
Key Features:
- Markdown support for notes
- Use categories and priorities to organize your notes, tasks, and habits
- Advanced Search, Filter, and Sort
- Data Export/Import: JSON, YAML, TSV, Markdown
- Import your notes from Google Keep
- Available in 26 themes with Dark and Light modes
base: core22
confinement: strict #devmode
layout:
/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/webkit2gtk-4.0:
bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/webkit2gtk-4.0
# /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/webkit2gtk-4.1:
# bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/webkit2gtk-4.1
parts:
openhabittracker:
plugin: dotnet
dotnet-build-configuration: Release
dotnet-self-contained-runtime-identifier: linux-x64
source: .
override-build: |
dotnet publish OpenHabitTracker.Blazor.Photino/OpenHabitTracker.Blazor.Photino.csproj -r linux-x64 -c Release -p:PublishSingleFile=true --self-contained true -f net8.0 -o $SNAPCRAFT_PART_INSTALL
chmod 0755 $SNAPCRAFT_PART_INSTALL/OpenHT
build-packages:
#- libwebkit2gtk-4.1-dev
- dotnet-sdk-8.0
stage-packages:
#- libwebkit2gtk-4.1-0
- libwebkit2gtk-4.0-37
- libnotify4
- libicu70
- libglu1-mesa
- freeglut3
- libwebkit2gtk-4.0-dev
- webkit2gtk-driver
- libcanberra-gtk3-module
- libcanberra-gtk-module
- libgl1-mesa-dri
- mesa-vulkan-drivers
- libgbm1
- libglx-mesa0
- gtk2-engines-murrine # Add Murrine engine for theme rendering
- gtk2-engines-pixbuf # Pixbuf engine for GTK2 themes
- hicolor-icon-theme # Adds the hicolor icon theme
- adwaita-icon-theme # Adds the default GNOME icon theme
- gnome-themes-standard # Provides Adwaita theme
- libgdk-pixbuf2.0-0 # Required for loading image files in GTK
apps:
openhabittracker:
command: OpenHT
plugs:
- opengl
- hardware-observe
- home
- removable-media
- x11
- wayland
- desktop
- desktop-legacy
- mount-observe
- gsettings
- network
environment:
LIBGL_DRIVERS_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/dri
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/dri
GDK_PIXBUF_MODULE_FILE: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/gdk-pixbuf-2.0/2.10.0/loaders.cache
GTK_DATA_PREFIX: $SNAP
XDG_DATA_DIRS: $SNAP/usr/share:$SNAP/usr/local/share:/usr/share:/usr/local/share
@Jinjinov I am not familiar with creating Snap packages tbh. Perhaps the publishing guide can help you figure it out?
https://github.com/tryphotino/photino.Samples/tree/master/Photino.PublishPhotino/PublishPhotino#universal-packaging-with-flatpak
I successfully published a Snap: https://snapcraft.io/openhabittracker
I used extensions: [gnome]
that adds all needed libraries instead of manually adding them myself.
The config is much shorter now:
name: openhabittracker
title: OpenHabitTracker
icon: net.openhabittracker.OpenHabitTracker.svg
website: https://openhabittracker.net
source-code: https://github.com/Jinjinov/OpenHabitTracker
issues: https://github.com/Jinjinov/OpenHabitTracker/issues
license: GPL-3.0
version: '1.0.0'
grade: stable #devel
summary: Take notes, plan tasks, track habits
description: |
- Free and Ad-Free
- Open Source
- Privacy Focused: All user data is stored locally on your device
- Available on Windows, Linux, Android, iOS, macOS, and as a web app
- Localized to English, German, Spanish, Slovenian
Key Features:
- Markdown support for notes
- Use categories and priorities to organize your notes, tasks, and habits
- Advanced Search, Filter, and Sort
- Data Export/Import: JSON, YAML, TSV, Markdown
- Import your notes from Google Keep
- Available in 26 themes with Dark and Light modes
base: core22
confinement: strict #devmode
parts:
openhabittracker:
plugin: dotnet
dotnet-build-configuration: Release
dotnet-self-contained-runtime-identifier: linux-x64
source: .
override-build: |
dotnet publish OpenHabitTracker.Blazor.Photino/OpenHabitTracker.Blazor.Photino.csproj -r linux-x64 -c Release -p:PublishSingleFile=true --self-contained true -f net8.0 -o $SNAPCRAFT_PART_INSTALL
chmod 0755 $SNAPCRAFT_PART_INSTALL/OpenHT
build-packages:
- dotnet-sdk-8.0
apps:
openhabittracker:
extensions: [gnome]
command: OpenHT
plugs:
- hardware-observe
- home
- removable-media
- network