ci: fix node install with nvm

This commit is contained in:
abeimler 2023-04-06 14:40:23 +02:00
parent d9316c0cbc
commit bfe7d5afde
3 changed files with 39 additions and 10 deletions

View File

@ -4,11 +4,21 @@ FROM ubuntu:20.04 as base
ENV TZ=Canada/Pacific ENV TZ=Canada/Pacific
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# install node with nvm
RUN apt-get update -qq && apt-get install -y --no-install-recommends git curl wget ca-certificates
ARG nvm_version="0.39.3" ARG nvm_version="0.39.3"
ARG node_version="16.20.0" ARG node_version="16.20.0"
RUN touch ~/.bashrc && chmod +x ~/.bashrc RUN mkdir /usr/local/nvm
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${nvm_version}/install.sh | bash ENV NVM_DIR /usr/local/nvm
RUN source ~/.nvm/nvm.sh && nvm install ${node_version} ADD https://raw.githubusercontent.com/nvm-sh/nvm/v${nvm_version}/install.sh /nvm_install.sh
RUN chmod +x /nvm_install.sh && /nvm_install.sh \
&& . $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
# add setup-cpp.js # add setup-cpp.js
COPY "./dist/node16" "/" COPY "./dist/node16" "/"

View File

@ -4,10 +4,20 @@ FROM ubuntu:20.04 as base
ENV TZ=Canada/Pacific ENV TZ=Canada/Pacific
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# install node with nvm
RUN apt-get update -qq && apt-get install -y --no-install-recommends git curl wget ca-certificates
ARG nvm_version="0.39.3" ARG nvm_version="0.39.3"
RUN touch ~/.bashrc && chmod +x ~/.bashrc ARG node_version="12.22.12"
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${nvm_version}/install.sh | bash RUN mkdir /usr/local/nvm
RUN source ~/.nvm/nvm.sh && nvm install 12 ENV NVM_DIR /usr/local/nvm
ADD https://raw.githubusercontent.com/nvm-sh/nvm/v${nvm_version}/install.sh /nvm_install.sh
RUN chmod +x /nvm_install.sh && /nvm_install.sh \
&& . $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
# add setup-cpp.js # add setup-cpp.js
COPY "./dist/node12" "/" COPY "./dist/node12" "/"

View File

@ -1,14 +1,23 @@
FROM ubuntu:20.04 as base FROM ubuntu:22.04 as base
# set time-zone # set time-zone
ENV TZ=Canada/Pacific ENV TZ=Canada/Pacific
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# install node with nvm
RUN apt-get update -qq && apt-get install -y --no-install-recommends git curl wget ca-certificates
ARG nvm_version="0.39.3" ARG nvm_version="0.39.3"
ARG node_version="18.15.0" ARG node_version="18.15.0"
RUN touch ~/.bashrc && chmod +x ~/.bashrc RUN mkdir /usr/local/nvm
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${nvm_version}/install.sh | bash ENV NVM_DIR /usr/local/nvm
RUN source ~/.nvm/nvm.sh && nvm install ${node_version} ADD https://raw.githubusercontent.com/nvm-sh/nvm/v${nvm_version}/install.sh /nvm_install.sh
RUN chmod +x /nvm_install.sh && /nvm_install.sh \
&& . $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
# add setup-cpp.js # add setup-cpp.js
COPY "./dist/node18" "/" COPY "./dist/node18" "/"