From c56d49e6ff32c21a35743b291f2a8c4b102b2d63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E8=83=9C=E5=8F=91?= Date: Thu, 22 Feb 2024 15:17:02 +0800 Subject: [PATCH] feat: code-server --- Dockerfile | 19 ++++++++++++++----- docker-entry-point.sh | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 194df3c..5231a16 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,12 +5,10 @@ WORKDIR /app COPY . . -VOLUME [ "/data", "/root/.ssh", "/root/.vscode-server" ] +VOLUME [ "/project", "/root/.ssh", "/root/.local", "/root/.config" ] # 运行时可以添加代理 ARG PROXY -# ENV https_proxy=${PROXY} -# ENV http_proxy=${PROXY} # 安装基础工具与配置文件 RUN echo "安装基础工具与配置文件" && \ @@ -47,9 +45,9 @@ RUN echo "安装 node 环境" && \ # 安装 n node 管理器 brew install n && \ # 安装最新版本 node - n stable && \ + n 18.15.0 # 安装 web 服务器 - npm i -g live-server + # npm i -g live-server # 安装 python 环境 RUN echo "安装 python 环境" && \ @@ -79,5 +77,16 @@ RUN echo "配置 ssh" && \ ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N '' && \ sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/" /etc/ssh/sshd_config +# 安装 code-server +RUN echo "安装 code-server" && \ + export http_proxy=${PROXY} && \ + export https_proxy=${PROXY} && \ + apt update && \ + # apt-get install -y build-essential pkg-config python3 && \ + apt install -y pkg-config && \ + npm config set python python3 && \ + npm install --global code-server --unsafe-perm + + ENTRYPOINT ["/app/docker-entry-point.sh"] diff --git a/docker-entry-point.sh b/docker-entry-point.sh index 04954a9..b450067 100755 --- a/docker-entry-point.sh +++ b/docker-entry-point.sh @@ -29,4 +29,4 @@ fi service ssh start >> /app/info.log ssh-agent bash >> /app/info.log -tail -f /app/info.log +code-server