nvm-container-nodev16/Dockerfile

36 lines
990 B
Docker
Raw Normal View History

2023-10-21 14:39:25 +05:30
# credits: https://gist.github.com/remarkablemark/aacf14c29b3f01d6900d13137b21db3a
# thanks github.com/remarkablemark
FROM debian:latest
# replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# update the repository sources list
# and install dependencies
RUN apt-get update \
&& apt-get install -y curl \
&& apt-get -y autoclean
# nvm environment variables
ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 16.20.2
# install nvm
# https://github.com/creationix/nvm#install-script
2023-10-21 14:42:00 +05:30
RUN curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash
2023-10-21 14:39:25 +05:30
# install node and npm
RUN source $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
# add node and npm to path so the commands are available
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
# confirm installation
RUN node -v
RUN npm -v