npm installation
MODIFY
repo2docker/buildpacks/base.py
repo2docker/buildpacks/base.py
@@ -356,6 +356,7 @@ class BuildPack:
You can use environment variable substitutions in both the
username and the execution script.
"""
+
return []
def get_assemble_scripts(self):
@@ -520,9 +521,35 @@ class BaseImage(BuildPack):
def get_build_env(self):
"""Return env directives required for build"""
return [
- ("APP_BASE", "/srv")
+ ("APP_BASE", "/srv"),
+ ('NPM_DIR', '${APP_BASE}/npm'),
+ ('NPM_CONFIG_GLOBALCONFIG','${NPM_DIR}/npmrc')
+ ]
+
+ def get_path(self):
+ return super().get_path() + [
+ '${NPM_DIR}/bin'
+ ]
+
+ def get_build_scripts(self):
+ scripts = [
+ (
+ "root",
+ r"""
+ mkdir -p ${NPM_DIR} && \
+ chown -R ${NB_USER}:${NB_USER} ${NPM_DIR}
+ """
+ ),
+ (
+ "${NB_USER}",
+ r"""
+ npm config --global set prefix ${NPM_DIR}
+ """
+ ),
]
+ return super().get_build_scripts() + scripts
+
def get_env(self):
"""Return env directives to be set after build"""
env = []
@@ -541,7 +568,6 @@ class BaseImage(BuildPack):
])
return env
-
def detect(self):
return True

MODIFY
tests/venv/postBuild/postBuild
tests/venv/postBuild/postBuild
#!/bin/bash
jupyter nbextension enable --py --sys-prefix ipyleaflet
+npm install --global configurable-http-proxy
\ No newline at end of file

MODIFY
tests/venv/postBuild/verify
tests/venv/postBuild/verify
#!/bin/bash
set -euo pipefail
jupyter nbextension list | grep 'jupyter-leaflet' | grep enabled
+which configurable-http-proxy

npm installation