Skip to content

Commit

Permalink
Update new nodejs installation method for Dockerfile (#30)
Browse files Browse the repository at this point in the history
Because the traditional `setup_XX.x` script is deprecated, and there is a need to migrate to the new installation method.
  • Loading branch information
m11o authored Mar 12, 2024
1 parent 19ce958 commit 54b9602
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ FROM ruby:$RUBY_VERSION-slim
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libvips gnupg2 curl git

# Ensure node.js 18 is available for apt-get
ARG NODE_MAJOR=18
RUN curl -sL https://deb.nodesource.com/setup_$NODE_MAJOR.x | bash -
# Ensure node.js 20 is available for apt-get
ARG NODE_MAJOR=20
RUN apt-get update && \
mkdir -p /etc/apt/keyrings && \
curl --fail --silent --show-error --location https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
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

# Install node and yarn
RUN apt-get update -qq && apt-get install -y nodejs && npm install -g yarn
Expand Down

0 comments on commit 54b9602

Please sign in to comment.