Skip to content

Commit

Permalink
support download node.js according to linux arch
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongtong committed Dec 9, 2024
1 parent 43cd198 commit 6b579ff
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions Dockerfile.build-and-run
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@ RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
apt-get update && \
apt-get install -y yarn xz-utils

#安装构建web页面所需的node.js
RUN wget https://nodejs.org/dist/v18.20.3/node-v18.20.3-linux-x64.tar.xz && \
tar Jxvf /build/node-v18.20.3-linux-x64.tar.xz && \

#根据架构安装构建web页面所需的node.js
RUN ARCH=$(uname -m) && \
if [ $ARCH = 'x86_64' ]; then \
NODE_ARCH='x64'; \
elif [ $ARCH = 'aarch64' ]; then \
NODE_ARCH='arm64'; \
else \
echo '不支持的架构: $ARCH'; \
fi && \
wget https://nodejs.org/dist/v18.20.3/node-v18.20.3-linux-${NODE_ARCH}.tar.xz && \
tar Jxvf /build/node-v18.20.3-linux-${NODE_ARCH}.tar.xz && \
rm -rf /usr/bin/node /usr/bin/npm && \
ln -s /build/node-v18.20.3-linux-x64/bin/node /usr/bin/node && \
ln -s /build/node-v18.20.3-linux-x64/bin/npm /usr/bin/npm
ln -s /build/node-v18.20.3-linux-${NODE_ARCH}/bin/node /usr/bin/node && \
ln -s /build/node-v18.20.3-linux-${NODE_ARCH}/bin/npm /usr/bin/npm

COPY . .

Expand Down

0 comments on commit 6b579ff

Please sign in to comment.