File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change 1
1
# 使用官方的 linuxserver/code-server 基础镜像
2
2
FROM linuxserver/code-server:latest
3
3
4
+ # Set the SHELL to bash with pipefail option
5
+ SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
6
+
4
7
# 安装 nvm 所需的依赖
5
8
RUN apt-get update && apt-get install -y \
6
9
curl \
7
10
git \
8
11
build-essential \
9
12
libssl-dev \
10
13
&& rm -rf /var/lib/apt/lists/*
11
-
12
- # 设置环境变量
13
- ENV NVM_DIR=/root/.nvm
14
-
15
- # 下载并安装 nvm
16
- RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
17
-
18
- # 配置 nvm 环境变量
19
- ENV PATH=${NVM_DIR}/versions/node/v20.11.1/bin:${PATH}
14
+
15
+ # Create a script file sourced by both interactive and non-interactive bash shells
16
+ ENV BASH_ENV /home/user/.bash_env
17
+ RUN touch "${BASH_ENV}"
18
+ RUN echo '. "${BASH_ENV}"' >> ~/.bashrc
20
19
21
20
# 加载 nvm 并安装 Node.js v20.11.1
22
- RUN . $NVM_DIR/nvm.sh \
23
- && nvm install 20.11.1 \
24
- && nvm use 20.11.1 \
25
- && nvm alias default 20.11.1
21
+ RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | PROFILE="${BASH_ENV}" bash
22
+ RUN echo node > .nvmrc
23
+ RUN nvm install 20.11.1
24
+ RUN nvm use 20.11.1
25
+ RUN nvm alias default 20.11.1
26
26
27
27
# 可选:验证 Node.js 和 npm 版本
28
28
RUN node -v && npm -v
You can’t perform that action at this time.
0 commit comments