Skip to content

Instantly share code, notes, and snippets.

@dmiro
Last active December 5, 2023 16:19
Show Gist options
  • Save dmiro/e71317cc3ec6e95b4938e0142ebfd034 to your computer and use it in GitHub Desktop.
Save dmiro/e71317cc3ec6e95b4938e0142ebfd034 to your computer and use it in GitHub Desktop.
Docker: Install node 12 with nvm (Node Version Manager)
# updating NODE
# to install node 12 we need install with nvm because the new
# installation method (see https://deb.nodesource.com) is only
# supported from version 18
ENV NVM_VERSION v0.39.6
ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION v12.22.12
RUN mkdir $NVM_DIR
RUN apt-get install -y curl \
&& curl -o- https://raw.githubusercontent.com/creationix/nvm/$NVM_VERSION/install.sh | bash
ENV NODE_PATH $NVM_DIR/$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/$NODE_VERSION/bin:$PATH
RUN echo "source $NVM_DIR/nvm.sh && \
nvm install $NODE_VERSION && \
nvm alias default $NODE_VERSION && \
nvm use default" | bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment