FROM codercom/code-server EXPOSE 8080 EXPOSE 22 USER root WORKDIR /home/coder VOLUME [ "/home/coder/project", "/home/coder/.ssh", "/home/coder/.local", "/home/coder/.config" ] COPY entrypoint.sh /usr/bin/ ENV ENTRYPOINTD=/entrypoint.d # 运行时可以添加代理 ARG PROXY # 安装基础工具与配置文件 RUN echo "安装基础工具与配置文件" && \ echo ${PROXY} && \ 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" > /home/coder/.inputrc && \ apt-get update && \ # 时区 apt-get install -y tzdata && \ ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure -f noninteractive tzdata && \ # 安装 curl apt-get install -y curl && \ # 安装 vim apt-get install -y vim && \ # 安装 git # apt-get install -y git && \ # 安装 ssh 服务 apt-get install -y openssh-server && \ # 创建日志文件 mkdir /tmp/log && \ touch /tmp/log/info.log && \ chmod 777 /tmp/log/info.log && \ 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 && \ apt-get install -y nodejs npm && \ npm install -g n && \ # apt-get install -y build-essential && \ # 安装 n node 管理器 # brew install n && \ # 安装最新版本 node 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 # 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 # 配置 ssh RUN 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 && \ ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N '' && \ rm -f /etc/ssh/ssh_host_ecdsa_key && \ ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N '' && \ rm -f /etc/ssh/ssh_host_ed25519_key && \ 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", "."]