From 8ef545d5ee909d37e1c68b6979ba432647f83f54 Mon Sep 17 00:00:00 2001 From: mol Date: Sat, 24 Feb 2024 13:16:02 +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 | 54 +++++++++++++----------------------------------------- 1 file changed, 13 insertions(+), 41 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8bfd42f..8778877 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,14 +12,9 @@ COPY entrypoint.sh /usr/bin/ ENV ENTRYPOINTD=/entrypoint.d -# 运行时可以添加代理 -ARG PROXY - # 安装基础工具与配置文件 RUN echo "安装基础工具与配置文件" && \ - echo ${PROXY} && \ - export http_proxy=${PROXY} && \ - export https_proxy=${PROXY} && \ + sed -i -e 's/deb.debian.org/mirrors.huaweicloud.com/g' -e 's/security.debian.org/mirrors.huaweicloud.com/g' /etc/apt/sources.list && \ # 设置shell echo -e "set meta-flag on \nset convert-meta off \nset input-meta on \nset output-meta on" > /home/coder/.inputrc && \ apt-get update && \ @@ -38,44 +33,32 @@ RUN echo "安装基础工具与配置文件" && \ mkdir /tmp/log && \ touch /tmp/log/info.log && \ chmod 777 /tmp/log/info.log && \ - chmod 777 /usr/bin/entrypoint.sh + chmod 777 /usr/bin/entrypoint.sh && \ # 安装 node 环境 -RUN echo "安装 node 环境" && \ - export http_proxy=${PROXY} && \ - export https_proxy=${PROXY} && \ - # 安装 brew - # curl -ofsSL install.sh https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | bash && \ - # (echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /root/.bashrc && \ - # eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && \ - apt-get update && \ + echo "安装 node 环境" && \ apt-get install -y nodejs npm && \ - npm install -g n && \ - # apt-get install -y build-essential && \ + # 安装 nrm + npm install -g nrm --registry=http://registry.npmmirror.com && \ + nrm use taobao && \ # 安装 n node 管理器 - # brew install n && \ + npm install -g n && \ # 安装最新版本 node - n 18.15.0 + n 18.15.0 && \ # 安装 web 服务器 # npm i -g live-server # 安装 python 环境 -RUN echo "安装 python 环境" && \ - export http_proxy=${PROXY} && \ - export https_proxy=${PROXY} && \ - apt-get update && \ - apt-get install -y python3 + echo "安装 python 环境" && \ + apt-get install -y python3 && \ # python3.8-dev python3.8-venv python3-pip python3-wheel # 安装 docker 环境 -RUN echo "安装 docker 环境" && \ - export http_proxy=${PROXY} && \ - export https_proxy=${PROXY} && \ - apt-get update && \ - apt-get install -y docker.io + echo "安装 docker 环境" && \ + apt-get install -y docker.io && \ # 配置 ssh -RUN echo "配置 ssh" && \ + echo "配置 ssh" && \ rm -f /etc/ssh/ssh_host_rsa_key && \ ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' && \ rm -f /etc/ssh/ssh_host_dsa_key && \ @@ -86,16 +69,5 @@ 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 install --global npm@^8 && \ -# npm config set python python3 && \ -# npm install --global code-server --unsafe-perm - ENTRYPOINT ["/usr/bin/entrypoint.sh", "--bind-addr", "0.0.0.0:8080", "."]