From 4922c5fafddfe9493f1c48b09bc1bc276751100b Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Wed, 22 Jun 2016 09:33:17 +0800 Subject: [PATCH] add Node Version Manager (nvm) Signed-off-by: Bo-Yi Wu --- workspace/Dockerfile | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 5f38cd06..e8456592 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -46,25 +46,11 @@ RUN apt-get update && apt-get install -y --force-yes \ git \ curl \ vim \ - nano \ - nodejs \ - nodejs-dev \ - npm + nano # Clean up, to free some space RUN apt-get clean -# Install gulp and bower with NPM -RUN npm install -g \ - gulp \ - bower - -# Link the global gulp to be used locally -RUN npm link gulp - -# Add a symbolic link for Node -RUN ln -s /usr/bin/nodejs /usr/bin/node - # Add an alias for PHPUnit RUN echo "alias phpunit='./vendor/bin/phpunit'" >> ~/.bashrc @@ -77,6 +63,18 @@ RUN curl -s http://getcomposer.org/installer | php \ RUN pecl install mongodb RUN echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini +# Install nvm (Node Version Manager) +RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash + +ENV NVM_DIR=/root/.nvm + +# Install stable node +RUN . ~/.nvm/nvm.sh \ + && nvm install stable \ + && nvm use stable \ + && nvm alias stable \ + && npm install -g gulp bower + # Source the bash RUN . ~/.bashrc