Skip to content

Instantly share code, notes, and snippets.

@abh006
Created April 25, 2022 13:09
Show Gist options
  • Save abh006/e236bac293e7c5bc8213587bf46ec1da to your computer and use it in GitHub Desktop.
Save abh006/e236bac293e7c5bc8213587bf46ec1da to your computer and use it in GitHub Desktop.
Dockerfile for Node image based on ubuntu
FROM ubuntu:20.04
# Install Node
ENV NODE_VERSION=18.0.0
RUN apt-get update && apt-get install -y curl
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
ENV NVM_DIR=/root/.nvm
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
# Install Yarn
RUN apt-get install -y gnupg2
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update -qq && apt-get install -y yarn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment