Merge pull request #418 from linuxserver/code-server-npmglobal-s6v3

switch to hybrid (code-server-npmglobal)
This commit is contained in:
aptalca
2022-09-04 21:15:41 -04:00
committed by GitHub
7 changed files with 26 additions and 3 deletions
+5 -3
View File
@@ -1,7 +1,9 @@
# NPM Global - Docker mod for code-server
# NPM Global - Docker mod for code-server/openvscode-server
This mod sets the NPM global folder to `/config` in code-server during container start.
This mod sets the NPM global folder to `/config` in code-server/openvscode-server during container start.
In code-server docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:code-server-npmglobal`
In code-server/openvscode-server docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:code-server-npmglobal`
If adding multiple mods, enter them in an array separated by `|`, such as `DOCKER_MODS=linuxserver/mods:code-server-nodejs|linuxserver/mods:code-server-npmglobal`
**This mod requires npm installed via a different mod**
@@ -0,0 +1,19 @@
#!/usr/bin/with-contenv bash
# check npm exists
if [ -f /usr/bin/npm ]; then
echo "creating npm global folder in /config"
mkdir -p /config/npm-global
echo "setting npm to global folder in /config"
npm config set prefix '/config/npm-global'
if grep -q "/config/npm-global/bin" "/etc/services.d/code-server/run"; then
echo "npm-global already in PATH"
else
echo "ensuring npm-global is in PATH"
sed -i '/^#!\/usr\/bin/a \\n# Added by codeserver-npmglobal\nexport PATH=/config/npm-global/bin:$PATH' /etc/services.d/code-server/run
fi
else
echo "**** npm not installed, skipping npmglobal install ****"
fi
@@ -0,0 +1 @@
oneshot
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-mod-code-server-npmglobal-install/run