Skip to content

Commit 4475f81

Browse files
authored
Update Dockerfile
fix nvm
1 parent 822af73 commit 4475f81

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

Dockerfile

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ FROM linuxserver/code-server:4.96.4-ls254
33

44
# Set the SHELL to bash with pipefail option
55
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
6+
# Prevent dialog during apt install
7+
ENV DEBIAN_FRONTEND noninteractive
68

79
# 安装 nvm 所需的依赖
810
RUN apt-get update && apt-get install -y \
@@ -11,11 +13,27 @@ RUN apt-get update && apt-get install -y \
1113
build-essential \
1214
libssl-dev \
1315
&& rm -rf /var/lib/apt/lists/*
14-
15-
# Create a script file sourced by both interactive and non-interactive bash shells
16-
ENV BASH_ENV=/config/.bash_env
17-
RUN touch "${BASH_ENV}"
18-
RUN echo '. "${BASH_ENV}"' >> ~/.bashrc
16+
17+
# Set locale
18+
RUN locale-gen en_US.UTF-8
19+
RUN bash --version | head -n 1
20+
RUN zsh --version
21+
RUN ksh --version || true
22+
RUN dpkg -s dash | grep ^Version | awk '{print $2}'
23+
RUN git --version
24+
RUN curl --version
25+
RUN wget --version
26+
RUN useradd -ms /bin/bash nvm
27+
COPY . /home/nvm/.nvm/
28+
RUN chown nvm:nvm -R "/home/nvm/.nvm"
29+
RUN echo 'nvm ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
30+
USER nvm
31+
ENV BASH_ENV /config/.bash_env
32+
RUN touch "$BASH_ENV"
33+
RUN echo '. "$BASH_ENV"' >> "$HOME/.bashrc"
34+
RUN echo 'export NVM_DIR="$HOME/.nvm"' >> "$BASH_ENV"
35+
RUN echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> "$BASH_ENV"
36+
RUN echo '[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion' >> "$BASH_ENV"
1937

2038
# 加载 nvm 并安装 Node.js v20.11.1
2139
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | PROFILE="${BASH_ENV}" bash

0 commit comments

Comments
 (0)