feat: add nvm and yarn installation to Dockerfile
- Install NVM for managing Node.js versions - Set environment variables for NVM and Node.js - Install Yarn globally using npm This commit enhances the Dockerfile by adding support for Node.js version management through NVM and includes Yarn as a package manager. This setup allows for easier upgrades and management of Node.js dependencies in the container environment.
This commit is contained in:
parent
81906319ea
commit
06c0e393e4
18
Dockerfile
18
Dockerfile
@ -33,6 +33,24 @@ RUN apt-get update -qq && \
|
||||
apt-get install --no-install-recommends -y build-essential git pkg-config && \
|
||||
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
||||
|
||||
# 安装 NVM
|
||||
ENV NVM_DIR="/usr/local/nvm"
|
||||
ENV NODE_VERSION="18.20.4"
|
||||
|
||||
RUN mkdir -p $NVM_DIR && \
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash && \
|
||||
. $NVM_DIR/nvm.sh && \
|
||||
nvm install $NODE_VERSION && \
|
||||
nvm alias default $NODE_VERSION && \
|
||||
nvm use default
|
||||
|
||||
# 设置环境变量
|
||||
ENV NODE_PATH="$NVM_DIR/v$NODE_VERSION/lib/node_modules"
|
||||
ENV PATH="$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH"
|
||||
|
||||
# 安装 yarn
|
||||
RUN npm install -g yarn
|
||||
|
||||
# Install application gems
|
||||
COPY Gemfile Gemfile.lock ./
|
||||
RUN bundle install && \
|
||||
|
Loading…
Reference in New Issue
Block a user