Install node in Dockerfile?

前端 未结 4 1767
天涯浪人
天涯浪人 2021-02-04 00:15

I am user of AWS elastic beanstalk, and I have a little problem. I want to build my CSS files with less+node. But I don`t know how to install node in my dockerfile, when buildin

4条回答
  •  感情败类
    2021-02-04 00:40

    I think this works slightly better.

    ENV NODE_VERSION=12.6.0
    RUN apt install -y curl
    RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.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}"
    RUN node --version
    RUN npm --version
    

提交回复
热议问题