From 56e6abfecc3a386affd2230d442b71dcfd39e3e7 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 22 May 2024 15:01:09 +0100 Subject: Allow loading modules in Docker image This is done by mounting a `/modules` directory and installing packages into that. --- docker/start.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'docker/start.py') diff --git a/docker/start.py b/docker/start.py index 818a5355ca..bd0ef60420 100755 --- a/docker/start.py +++ b/docker/start.py @@ -269,6 +269,15 @@ running with 'migrate_config'. See the README for more details. args += ["--config-path", config_path] + # Add the `/modules` directly to python search path, which allows users to + # add custom modules. + # + # We want to add the directory *last* so that nothing can overwrite the + # existing package versions. Therefore we load the current path and append + # `/modules` to that + path = ":".join(sys.path) + environ["PYTHONPATH"] = f"{path}:/modules" + log("Starting synapse with args " + " ".join(args)) args = [sys.executable] + args -- cgit 1.5.1