Skip to content

Node.js based forum software built for the modern web

* Docker: add function to entrypoint to auto-install plugins on reboot (fixes #13735) (#13749)

b2ccda79582148a5
diff --git a/install/docker/entrypoint.sh b/install/docker/entrypoint.sh
index db2a637ee0..a38aa4196f 100755
--- a/install/docker/entrypoint.sh
+++ b/install/docker/entrypoint.sh
@@ -12,6 +12,7 @@ set_defaults() {
export SETUP="${SETUP:-}"
export PACKAGE_MANAGER="${PACKAGE_MANAGER:-npm}"
export OVERRIDE_UPDATE_LOCK="${OVERRIDE_UPDATE_LOCK:-false}"
+ export NODEBB_ADDITIONAL_PLUGINS="${NODEBB_ADDITIONAL_PLUGINS:-}"
}
# Function to check if a directory exists and is writable
@@ -172,6 +173,33 @@ debug_log() {
echo "DEBUG: $message"
}
+install_additional_plugins() {
+ if [[ ! -z ${NODEBB_ADDITIONAL_PLUGINS} ]]; then
+ export START_BUILD="true"
+ for plugin in "${NODEBB_ADDITIONAL_PLUGINS[@]}"; do
+ echo "Installing additional plugin ${plugin}..."
+ case "$PACKAGE_MANAGER" in
+ yarn) yarn install || {
+ echo "Failed to install plugin ${plugin} with yarn"
+ exit 1
+ } ;;
+ npm) npm install || {
+ echo "Failed to install plugin ${plugin} with npm"
+ exit 1
+ } ;;
+ pnpm) pnpm install || {
+ echo "Failed to install plugin ${plugin} with pnpm"
+ exit 1
+ } ;;
+ *)
+ echo "Unknown package manager: $PACKAGE_MANAGER"
+ exit 1
+ ;;
+ esac
+ done
+ fi
+}
+
# Main function
main() {
set_defaults
@@ -182,12 +210,14 @@ main() {
debug_log "PACKAGE_MANAGER: $PACKAGE_MANAGER"
debug_log "CONFIG location: $CONFIG"
debug_log "START_BUILD: $START_BUILD"
+ debug_log "NODEBB_ADDITIONAL_PLUGINS: ${NODEBB_ADDITIONAL_PLUGINS}"
if [ -n "$SETUP" ]; then
start_setup_session "$CONFIG"
fi
if [ -f "$CONFIG" ]; then
+ install_additional_plugins
start_forum "$CONFIG" "$START_BUILD"
else
start_installation_session "$NODEBB_INIT_VERB" "$CONFIG"