Skip to content

Instantly share code, notes, and snippets.

@facundofarias
Last active October 18, 2023 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save facundofarias/16667c2312693deafb48721a82e0d550 to your computer and use it in GitHub Desktop.
Save facundofarias/16667c2312693deafb48721a82e0d550 to your computer and use it in GitHub Desktop.
nodesource/distributions for Ubuntu on Docker
# Installing node.js (16) and npm: https://github.com/nodesource/distributions
ENV NODE_MAJOR=16
# 1. Download and import the Nodesource GPG key
RUN apt-get update
RUN apt-get install -y ca-certificates curl gnupg
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
# 2. Add the NodeSource package repositories for Debian-based distributions
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x focal main" | tee /etc/apt/sources.list.d/nodesource.list
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
# 3. Install Node.js from the Debian-based distributions repository
RUN apt-get update
RUN apt-get install -y nodejs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment