Skip to content

Instantly share code, notes, and snippets.

@jpralves
Created March 19, 2019 15:50
Show Gist options
  • Save jpralves/1199fd0a74b315aa598c3ca01aa36d9d to your computer and use it in GitHub Desktop.
Save jpralves/1199fd0a74b315aa598c3ca01aa36d9d to your computer and use it in GitHub Desktop.
snippet to use nvm in docker
# nvm environment variables
ENV NVM_DIR=/usr/local/nvm
ENV NVM_VERSION=0.33.11
ENV NODE_VERSION=8.10.0
# install nvm
# https://github.com/creationix/nvm#install-script
RUN [ -d $NVM_DIR ] || mkdir -p $NVM_DIR
RUN curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/v${NVM_VERSION}/install.sh | bash
# install node and npm, set default alias
RUN source $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
ENV NODE_PATH=$NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment