GoMFT: Add frontend build procedure (#3499)

This commit is contained in:
Slaviša Arežina
2025-03-30 17:15:59 +02:00
committed by GitHub
parent 453210900d
commit 92c6662abf
2 changed files with 28 additions and 4 deletions

View File

@@ -32,7 +32,13 @@ function update_script() {
if ! dpkg -l | grep -q "^ii.*build-essential"; then
$STD apt-get install -y build-essential
fi
if [[ ! -f "/usr/bin/node" ]]; then
mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
$STD apt-get update
$STD apt-get install -y nodejs
fi
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
msg_info "Stopping $APP"
systemctl stop gomft
@@ -45,8 +51,11 @@ function update_script() {
tar -xzf $temp_file
cp -rf GoMFT-v.${RELEASE}/* /opt/gomft
cd /opt/gomft
rm -f /opt/gomft/node_modules
$STD npm ci
$STD node build.js
$STD go mod download
$STD go install github.com/a-h/templ/cmd/templ@latest
$STD go get -u github.com/a-h/templ
$STD $HOME/go/bin/templ generate
export CGO_ENABLED=1
export GOOS=linux
@@ -57,7 +66,7 @@ function update_script() {
msg_info "Cleaning Up"
rm -f $temp_file
rm -rf GoMFT-${RELEASE}
rm -rf $HOME/GoMFT-v.${RELEASE}
msg_ok "Cleanup Complete"
msg_info "Starting $APP"