Skip to content

Commit c79e574

Browse files
committed
init Dockerfile
1 parent 2df3db8 commit c79e574

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# 使用官方的 linuxserver/code-server 基础镜像
2+
FROM linuxserver/code-server:latest
3+
4+
# 安装 nvm 所需的依赖
5+
RUN apt-get update && apt-get install -y \
6+
curl \
7+
git \
8+
sudo
9+
10+
# 设置环境变量
11+
ENV NVM_DIR=/usr/local/nvm
12+
ENV NODE_VERSION=20.11.1
13+
14+
# 安装 nvm
15+
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \
16+
&& source $NVM_DIR/nvm.sh \
17+
&& nvm install $NODE_VERSION \
18+
&& nvm alias default $NODE_VERSION \
19+
&& nvm use default
20+
21+
# 确保后续命令可以使用 nvm 和 node
22+
ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
23+
24+
# 可选:验证 Node.js 和 npm 版本
25+
RUN node -v && npm -v

0 commit comments

Comments
 (0)