diff options
Diffstat (limited to 'src/node')
-rw-r--r-- | src/node/devcontainer-feature.json | 2 | ||||
-rwxr-xr-x | src/node/install.sh | 14 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/node/devcontainer-feature.json b/src/node/devcontainer-feature.json index 8f92365..09097e5 100644 --- a/src/node/devcontainer-feature.json +++ b/src/node/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "node", - "version": "1.0.6", + "version": "1.0.7", "name": "Node.js (via nvm) and yarn", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/node", "description": "Installs Node.js, nvm, yarn, and needed dependencies.", diff --git a/src/node/install.sh b/src/node/install.sh index 6a237d6..2bdd21a 100755 --- a/src/node/install.sh +++ b/src/node/install.sh @@ -22,6 +22,9 @@ export NVM_VERSION="0.38.0" set -e +# Clean up +rm -rf /var/lib/apt/lists/* + if [ "$(id -u)" -ne 0 ]; then echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' exit 1 @@ -62,8 +65,10 @@ updaterc() { } apt_get_update() { - echo "Running apt-get update..." - apt-get update -y + if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then + echo "Running apt-get update..." + apt-get update -y + fi } # Checks if packages are installed and installs them if not @@ -109,6 +114,8 @@ if [ -d "${NVM_DIR}" ]; then if [ "${NODE_VERSION}" != "" ]; then su ${USERNAME} -c ". $NVM_DIR/nvm.sh && nvm install ${NODE_VERSION} && nvm clear-cache" fi + # Clean up + rm -rf /var/lib/apt/lists/* exit 0 fi @@ -187,4 +194,7 @@ fi find "${NVM_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s +# Clean up +rm -rf /var/lib/apt/lists/* + echo "Done!" |