2017-06-05 13:04:03 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-02-10 15:02:38 +01:00
|
|
|
#=================================================
|
2019-03-05 23:17:15 +01:00
|
|
|
# COMMON VARIABLES
|
2019-02-10 15:02:38 +01:00
|
|
|
#=================================================
|
2022-10-06 14:42:19 +02:00
|
|
|
|
|
|
|
nodejs_version=16
|
2019-02-10 15:02:38 +01:00
|
|
|
|
2023-06-10 17:54:32 +02:00
|
|
|
go_version=1.18
|
2019-03-05 23:11:52 +01:00
|
|
|
|
2019-03-05 23:17:15 +01:00
|
|
|
#=================================================
|
|
|
|
# PERSONAL HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2022-10-06 14:42:19 +02:00
|
|
|
build_fider() {
|
2023-06-09 21:48:46 +02:00
|
|
|
ynh_exec_as "$app" mkdir -p "$install_dir/go_build"
|
|
|
|
ynh_secure_remove -f "$install_dir/app"
|
|
|
|
mkdir -p "$install_dir/app"
|
2022-10-06 14:42:19 +02:00
|
|
|
|
2023-06-09 21:48:46 +02:00
|
|
|
pushd "$install_dir/sources" || ynh_die --message "Could not move into $install_dir/sources!"
|
2022-10-06 14:42:19 +02:00
|
|
|
# Build server
|
|
|
|
ynh_exec_as "$app" \
|
2023-06-09 21:48:46 +02:00
|
|
|
GOPATH="$install_dir/go_build/go" \
|
|
|
|
GOCACHE="$install_dir/go_build/.cache" \
|
2022-10-06 14:42:19 +02:00
|
|
|
GOOS=linux GOARCH="$(dpkg --print-architecture)" \
|
2023-06-09 21:48:46 +02:00
|
|
|
"PATH=/usr/lib/go-1.18/bin:$PATH" \
|
2022-10-06 14:42:19 +02:00
|
|
|
make build-server
|
2023-06-09 21:48:46 +02:00
|
|
|
cp -R migrations views locale LICENSE fider "$install_dir/app"
|
2022-10-06 14:42:19 +02:00
|
|
|
|
|
|
|
# Build UI
|
|
|
|
ynh_use_nodejs
|
|
|
|
ynh_exec_as "$app" $ynh_node_load_PATH $ynh_npm ci
|
|
|
|
ynh_exec_as "$app" $ynh_node_load_PATH make build-ssr
|
|
|
|
ynh_exec_as "$app" $ynh_node_load_PATH make build-ui
|
2023-06-09 21:48:46 +02:00
|
|
|
cp -R favicon.png dist robots.txt ssr.js "$install_dir/app"
|
|
|
|
popd || ynh_die
|
|
|
|
chown "$app:www-data" -R "$install_dir/app"
|
2022-10-06 14:42:19 +02:00
|
|
|
}
|
|
|
|
|
2019-02-10 15:02:38 +01:00
|
|
|
#=================================================
|
|
|
|
# EXPERIMENTAL HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2023-06-10 17:43:10 +02:00
|
|
|
#=================================================
|
|
|
|
# FUTURE OFFICIAL HELPERS
|
|
|
|
#=================================================
|