Files
my-dev-server/Dockerfile
2024-01-26 04:14:09 +00:00

73 lines
2.1 KiB
Docker

FROM ubuntu
EXPOSE 8080
EXPOSE 22
WORKDIR /app
COPY . .
VOLUME [ "/data", "/root/.ssh", "/etc/ssh/sshd_config" ]
# 运行时可以添加代理
ARG PROXY
# ENV https_proxy=${PROXY}
# ENV http_proxy=${PROXY}
# 安装基础工具与配置文件
RUN export http_proxy=${PROXY} && \
export https_proxy=${PROXY} && \
apt-get update && \
# 安装 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 && \
# 创建日志文件
touch info.log
# 安装 node 环境
RUN 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 build-essential && \
# 安装 n node 管理器
brew install n && \
# 安装最新版本 node
n stable && \
# 安装 web 服务器
npm i -g live-server
# 安装 python 环境
RUN export http_proxy=${PROXY} && \
export https_proxy=${PROXY} && \
apt update && \
apt install -y software-properties-common && \
add-apt-repository ppa:deadsnakes/ppa && \
apt install -y python3.8
# 安装 docker 环境
RUN export http_proxy=${PROXY} && \
export https_proxy=${PROXY} && \
apt update && \
apt install -y docker.io
# 配置 ssh
RUN 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 ["/app/docker-entry-point.sh"]