File tree Expand file tree Collapse file tree 3 files changed +34
-2
lines changed
registry/coder/modules/jupyter-notebook Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ A module that adds Jupyter Notebook in your Coder template.
16
16
module "jupyter-notebook" {
17
17
count = data.coder_workspace.me.start_count
18
18
source = "registry.coder.com/coder/jupyter-notebook/coder"
19
- version = "1.1.1 "
19
+ version = "1.2.0 "
20
20
agent_id = coder_agent.example.id
21
21
}
22
22
```
Original file line number Diff line number Diff line change @@ -48,13 +48,27 @@ variable "group" {
48
48
default = null
49
49
}
50
50
51
+ variable "requirements_path" {
52
+ type = string
53
+ description = " The path to requirements.txt with packages to preinstall"
54
+ default = " "
55
+ }
56
+
57
+ variable "pip_install_extra_packages" {
58
+ type = string
59
+ description = " List of extra packages to preinstall (example: numpy==1.26.4 pandas matplotlib<4 scikit-learn)"
60
+ default = " "
61
+ }
62
+
51
63
resource "coder_script" "jupyter-notebook" {
52
64
agent_id = var. agent_id
53
65
display_name = " jupyter-notebook"
54
66
icon = " /icon/jupyter.svg"
55
67
script = templatefile (" ${ path . module } /run.sh" , {
56
68
LOG_PATH : var.log_path,
57
- PORT : var.port
69
+ PORT : var.port,
70
+ REQUIREMENTS_PATH : var.requirements_path,
71
+ PIP_INSTALL_EXTRA_PACKAGES : var.pip_install_extra_packages
58
72
})
59
73
run_on_start = true
60
74
}
Original file line number Diff line number Diff line change 20
20
echo " 🥳 jupyter-notebook is already installed\n\n"
21
21
fi
22
22
23
+ # Install packages selected with REQUIREMENTS_PATH
24
+ if [ -n " ${REQUIREMENTS_PATH} " ]; then
25
+ if [ -f " ${REQUIREMENTS_PATH} " ]; then
26
+ echo " 📄 Installing packages from ${REQUIREMENTS_PATH} ..."
27
+ pipx -q runpip notebook install -r " ${REQUIREMENTS_PATH} "
28
+ echo " 🥳 Packages from ${REQUIREMENTS_PATH} have been installed\n\n"
29
+ else
30
+ echo " ⚠️ REQUIREMENTS_PATH is set to '${REQUIREMENTS_PATH} ' but the file does not exist!\n\n"
31
+ fi
32
+ fi
33
+
34
+ # Install packages selected with PIP_INSTALL_EXTRA_PACKAGES
35
+ if [ -n " ${PIP_INSTALL_EXTRA_PACKAGES} " ]; then
36
+ echo " 📦 Installing additional packages: ${PIP_INSTALL_EXTRA_PACKAGES} "
37
+ pipx -q runpip notebook install ${PIP_INSTALL_EXTRA_PACKAGES}
38
+ echo " 🥳 Additional packages have been installed\n\n"
39
+ fi
40
+
23
41
echo " 👷 Starting jupyter-notebook in background..."
24
42
echo " check logs at ${LOG_PATH} "
25
43
$HOME /.local/bin/jupyter-notebook --NotebookApp.ip=' 0.0.0.0' --ServerApp.port=${PORT} --no-browser --ServerApp.token=' ' --ServerApp.password=' ' > ${LOG_PATH} 2>&1 &
You can’t perform that action at this time.
0 commit comments