From 3ce27807ff0bf03601138659785cc08675126851 Mon Sep 17 00:00:00 2001 From: mol Date: Sat, 24 Feb 2024 05:25:01 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index dbcaa17..d285a61 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,13 +3,15 @@ FROM codercom/code-server EXPOSE 8080 EXPOSE 22 -USER root -WORKDIR /root +USER coder +WORKDIR /home/coder + +VOLUME [ "/home/coder/project", "/root/.ssh", "/root/.local", "/root/.config" ] COPY entrypoint.sh /usr/bin/ RUN chmod 777 /usr/bin/entrypoint.sh -VOLUME [ "/root/project", "/root/.ssh", "/root/.local", "/root/.config" ] +USER root # 运行时可以添加代理 ARG PROXY @@ -19,7 +21,7 @@ RUN echo "安装基础工具与配置文件" && \ export http_proxy=${PROXY} && \ export https_proxy=${PROXY} && \ # 设置shell - echo -e "set meta-flag on \nset convert-meta off \nset input-meta on \nset output-meta on" > /root/.inputrc && \ + echo -e "set meta-flag on \nset convert-meta off \nset input-meta on \nset output-meta on" > /home/coder/.inputrc && \ apt-get update && \ # 时区 apt-get install -y tzdata && \ @@ -33,7 +35,8 @@ RUN echo "安装基础工具与配置文件" && \ # 安装 ssh 服务 apt-get install -y openssh-server && \ # 创建日志文件 - touch info.log + touch /tmp/log/info.log && \ + chmod 777 /tmp/log/info.log # 安装 node 环境 RUN echo "安装 node 环境" && \ @@ -93,6 +96,7 @@ RUN echo "配置 ssh" && \ # npm install --global npm@^8 && \ # npm config set python python3 && \ # npm install --global code-server --unsafe-perm +USER coder ENTRYPOINT ["/usr/bin/entrypoint.sh", "--bind-addr", "0.0.0.0:8080", "."]