Skip to content

Commit f7e1c9c

Browse files
authored
Update snapcraft.yaml
1 parent 6db46c0 commit f7e1c9c

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

s1panel/snap/snapcraft.yaml

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,15 @@ apps:
2828
SERVICE: 'true'
2929
NODE_ENV: 'production'
3030
S1PANEL_CONFIG: $HOME
31+
PATH: "$SNAP/node/bin:$PATH"
32+
FONTCONFIG_PATH: "$SNAP_USER_COMMON/fonts"
33+
FONTCONFIG_FILE: "fonts.conf"
34+
FONTCONFIG_CACHE: "$SNAP_USER_COMMON/fonts-cache"
3135

3236
parts:
3337
s1panel:
3438
source: .
3539
plugin: nil
36-
build-packages:
37-
- git
38-
- curl
39-
- ca-certificates
40-
4140
stage-packages:
4241
- libudev1
4342
- libusb-1.0-0
@@ -56,7 +55,6 @@ parts:
5655
- fonts-ebgaramond
5756
- fontconfig
5857
- fontconfig-config
59-
- nodejs
6058

6159
override-pull: |
6260
craftctl default
@@ -81,11 +79,12 @@ parts:
8179
8280
override-build: |
8381
craftctl default
84-
82+
83+
echo "Installing Development Packages..."
84+
8585
sudo apt-get update
8686
sudo apt-get install -y \
8787
build-essential \
88-
nodejs \
8988
libcairo2-dev \
9089
libgdk-pixbuf-2.0-0 \
9190
libgif-dev \
@@ -97,11 +96,26 @@ parts:
9796
libx11-6 \
9897
poppler-data \
9998
fonts-noto-color-emoji
100-
99+
100+
echo "Installing Node.js v18.20.8..."
101+
102+
NODE_VERSION=v18.20.8
103+
NODE_DIST=node-$NODE_VERSION-linux-x64
104+
NODE_URL=https://nodejs.org/dist/$NODE_VERSION/$NODE_DIST.tar.xz
105+
106+
mkdir -p $SNAPCRAFT_PART_INSTALL/node
107+
curl -sSL $NODE_URL | tar -xJf - -C $SNAPCRAFT_PART_INSTALL/node --strip-components=1
108+
109+
echo "Building s1panel..."
110+
111+
export PATH="$SNAPCRAFT_PART_INSTALL/node/bin:$PATH"
112+
101113
npm ci --build-from-source
102114
(cd gui; npm ci)
103115
(cd gui; npm run build)
104116

117+
echo "Installing s1panel..."
118+
105119
APP_HOME="$SNAPCRAFT_PART_INSTALL/s1panel"
106120

107121
mkdir -p $APP_HOME/{sensors,widgets,themes,node_modules,gui/dist,in.conf}
@@ -127,17 +141,10 @@ parts:
127141
mkdir -p "$SNAP_USER_COMMON/fonts-cache"
128142
sed "s|@SNAP@|$SNAP|g" "$SNAP/s1panel/in.conf/fonts.conf.in" > "$SNAP_USER_COMMON/fonts/fonts.conf"
129143

130-
export FONTCONFIG_PATH="$SNAP_USER_COMMON/fonts"
131-
export FONTCONFIG_FILE="fonts.conf"
132-
export FONTCONFIG_CACHE="$SNAP_USER_COMMON/fonts-cache"
133-
134144
fc-cache -f -r || true
135145

136146
cd "$SNAP/s1panel"
137147
exec node ./main.js
138148
EOF
139149

140150
chmod +x $SNAPCRAFT_PART_INSTALL/launch-s1panel.sh
141-
142-
143-

0 commit comments

Comments
 (0)