feat: test
This commit is contained in:
64
Dockerfile
64
Dockerfile
@ -1,36 +1,66 @@
|
||||
FROM node
|
||||
FROM ubuntu
|
||||
EXPOSE 8080
|
||||
EXPOSE 22
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
VOLUME [ "/data" ]
|
||||
VOLUME [ "/data", "/root/.ssh", "/etc/ssh/sshd_config" ]
|
||||
|
||||
# 运行时可以添加代理
|
||||
ARG PROXY
|
||||
ENV https_proxy=${PROXY}
|
||||
ENV http_proxy=${PROXY}
|
||||
# ENV https_proxy=${PROXY}
|
||||
# ENV http_proxy=${PROXY}
|
||||
|
||||
RUN export http_proxy=$http_proxy \
|
||||
&& export https_proxy=$https_proxy \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y vim \
|
||||
&& apt-get install -y git \
|
||||
&& apt-get install -y openssh-server \
|
||||
&& npm i -g n \
|
||||
&& npm i -g live-server \
|
||||
&& touch info.log
|
||||
# 安装基础工具
|
||||
RUN export http_proxy=$http_proxy && \
|
||||
export https_proxy=$https_proxy && \
|
||||
apt-get update && \
|
||||
# 安装 vim
|
||||
apt-get install -y vim && \
|
||||
# 安装 git
|
||||
apt-get install -y git && \
|
||||
# 安装 ssh 服务
|
||||
apt-get install -y openssh-server && \
|
||||
# 创建日志文件
|
||||
touch info.log
|
||||
|
||||
RUN rm -f /etc/ssh/ssh_host_rsa_key && \
|
||||
# 安装 node 环境
|
||||
RUN export http_proxy=$http_proxy && \
|
||||
export https_proxy=$https_proxy && \
|
||||
# 安装 brew
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && \
|
||||
# 安装 n node 管理器
|
||||
brew install n && \
|
||||
# 安装最新版本 node
|
||||
n stable && \
|
||||
# 安装 web 服务器
|
||||
npm i -g live-server
|
||||
|
||||
# 安装 python 环境
|
||||
RUN export http_proxy=$http_proxy && \
|
||||
export https_proxy=$https_proxy && \
|
||||
apt update && \
|
||||
apt install software-properties-common && \
|
||||
add-apt-repository ppa:deadsnakes/ppa && \
|
||||
apt install python3.8
|
||||
|
||||
# 安装 docker 环境
|
||||
RUN export http_proxy=$http_proxy && \
|
||||
export https_proxy=$https_proxy && \
|
||||
apt update && \
|
||||
apt install 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 ''
|
||||
|
||||
RUN sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/" /etc/ssh/sshd_config
|
||||
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"]
|
||||
|
||||
|
@ -6,11 +6,16 @@ if [ -n "$ROOT_PASSWD" ]; then
|
||||
fi
|
||||
|
||||
if [ -n "$GIT_USER" ] && [ -n "$GIT_EMAIL" ]; then
|
||||
git config --global user.name "$GIT_USER"
|
||||
git config --global user.email "$GIT_EMAIL"
|
||||
git config --global user.name "$GIT_USER" >> /app/info.log
|
||||
git config --global user.email "$GIT_EMAIL" >> /app/info.log
|
||||
echo "git 用户已设置完毕" >> /app/info.log
|
||||
fi
|
||||
|
||||
service ssh start
|
||||
if [ -n "$DOCKER_USER" ] && [ -n "$DOCKER_PASSWD" ]; then
|
||||
docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWD" >> /app/info.log
|
||||
echo "docker 用户登录完成" >> /app/info.log
|
||||
fi
|
||||
|
||||
service ssh start >> /app/info.log
|
||||
|
||||
tail -f /app/info.log
|
||||
|
Reference in New Issue
Block a user