99 lines
4.2 KiB
Docker
99 lines
4.2 KiB
Docker
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
|
|
|
|
# 安装基础工具与配置文件
|
|
RUN echo "安装基础工具与配置文件" && \
|
|
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 && \
|
|
# 时区
|
|
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 环境
|
|
echo "安装 node 环境" && \
|
|
# apt-get install -y npm && \
|
|
# 安装 brew 管理器
|
|
# git clone https://mirrors.aliyun.com/homebrew/install.git brew-install && \
|
|
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git" && \
|
|
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git" && \
|
|
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles" && \
|
|
export HOMEBREW_API_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/api" && \
|
|
/bin/bash -c "$(curl -fsSL https://mirrors.ustc.edu.cn/misc/brew-install.sh)" && \
|
|
(echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /root/.bashrc && \
|
|
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && \
|
|
echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /root/.bashrc && \
|
|
echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"' >> /root/.bashrc && \
|
|
echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"' >> /root/.bashrc && \
|
|
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git" && \
|
|
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git" && \
|
|
apt-get install -y build-essential && \
|
|
# /bin/bash /root/install.sh && \
|
|
# rm -rf /root/install.sh && \
|
|
#echo 'export HOMEBREW_API_DOMAIN="https://mirrors.aliyun.com/homebrew-bottles/api"' >> ~/.bash_profile && \
|
|
##echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.aliyun.com/homebrew/brew.git"' >> ~/.bash_profile && \
|
|
#echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.aliyun.com/homebrew/homebrew-core.git"' >> ~/.bash_profile && \
|
|
#echo 'export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.aliyun.com/homebrew/homebrew-bottles"' >> ~/.bash_profile && \
|
|
#source ~/.bash_profile && \
|
|
brew update && \
|
|
# 安装 n node 管理器
|
|
brew install n && \
|
|
export N_NODE_MIRROR=https://npmmirror.com/mirrors/node/ && \
|
|
n 18.15.0 && \
|
|
# 安装 nrm
|
|
npm install -g nrm --registry=http://registry.npmmirror.com && \
|
|
nrm use taobao && \
|
|
# npm install -g n && \
|
|
# 安装最新版本 node
|
|
# 安装 web 服务器
|
|
# npm i -g live-server
|
|
|
|
# 安装 python 环境
|
|
echo "安装 python 环境" && \
|
|
apt-get install -y python3 && \
|
|
# python3.8-dev python3.8-venv python3-pip python3-wheel
|
|
|
|
# 安装 docker 环境
|
|
echo "安装 docker 环境" && \
|
|
apt-get install -y docker.io && \
|
|
|
|
# 配置 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 && \
|
|
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
|
|
|
|
ENTRYPOINT ["/usr/bin/entrypoint.sh", "--bind-addr", "0.0.0.0:8080", "."]
|
|
|