kopia lustrzana https://github.com/jupyterhub/repo2docker
Move npm config setting to the conda buildpack
Since everything is based off the conda buildpack now, and that is where we get npm frompull/847/head
rodzic
1d53990f34
commit
cbda2eba2b
|
@ -616,32 +616,8 @@ class BaseImage(BuildPack):
|
||||||
"""Return env directives required for build"""
|
"""Return env directives required for build"""
|
||||||
return [
|
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):
|
def get_env(self):
|
||||||
"""Return env directives to be set after build"""
|
"""Return env directives to be set after build"""
|
||||||
return []
|
return []
|
||||||
|
|
|
@ -33,6 +33,9 @@ class CondaBuildPack(BaseImage):
|
||||||
env = super().get_build_env() + [
|
env = super().get_build_env() + [
|
||||||
("CONDA_DIR", "${APP_BASE}/conda"),
|
("CONDA_DIR", "${APP_BASE}/conda"),
|
||||||
("NB_PYTHON_PREFIX", "${CONDA_DIR}/envs/notebook"),
|
("NB_PYTHON_PREFIX", "${CONDA_DIR}/envs/notebook"),
|
||||||
|
# We install npm / node from conda-forge
|
||||||
|
("NPM_DIR", "${APP_BASE}/npm"),
|
||||||
|
("NPM_CONFIG_GLOBALCONFIG", "${NPM_DIR}/npmrc"),
|
||||||
]
|
]
|
||||||
if self.py2:
|
if self.py2:
|
||||||
env.append(("KERNEL_PYTHON_PREFIX", "${CONDA_DIR}/envs/kernel"))
|
env.append(("KERNEL_PYTHON_PREFIX", "${CONDA_DIR}/envs/kernel"))
|
||||||
|
@ -55,6 +58,8 @@ class CondaBuildPack(BaseImage):
|
||||||
if self.py2:
|
if self.py2:
|
||||||
path.insert(0, "${KERNEL_PYTHON_PREFIX}/bin")
|
path.insert(0, "${KERNEL_PYTHON_PREFIX}/bin")
|
||||||
path.insert(0, "${NB_PYTHON_PREFIX}/bin")
|
path.insert(0, "${NB_PYTHON_PREFIX}/bin")
|
||||||
|
# This is at the end of $PATH, for backwards compat reasons
|
||||||
|
path.append("${NPM_DIR}/bin")
|
||||||
return path
|
return path
|
||||||
|
|
||||||
def get_build_scripts(self):
|
def get_build_scripts(self):
|
||||||
|
@ -83,7 +88,20 @@ class CondaBuildPack(BaseImage):
|
||||||
bash -c 'time /tmp/install-miniforge.bash' && \
|
bash -c 'time /tmp/install-miniforge.bash' && \
|
||||||
rm /tmp/install-miniforge.bash /tmp/environment.yml
|
rm /tmp/install-miniforge.bash /tmp/environment.yml
|
||||||
""",
|
""",
|
||||||
)
|
),
|
||||||
|
(
|
||||||
|
"root",
|
||||||
|
r"""
|
||||||
|
mkdir -p ${NPM_DIR} && \
|
||||||
|
chown -R ${NB_USER}:${NB_USER} ${NPM_DIR}
|
||||||
|
""",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"${NB_USER}",
|
||||||
|
r"""
|
||||||
|
npm config --global set prefix ${NPM_DIR}
|
||||||
|
""",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
major_pythons = {"2": "2.7", "3": "3.7"}
|
major_pythons = {"2": "2.7", "3": "3.7"}
|
||||||
|
|
Ładowanie…
Reference in New Issue