-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.sshd
More file actions
90 lines (84 loc) · 2.71 KB
/
Dockerfile.sshd
File metadata and controls
90 lines (84 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
## 2. 安装 webtop [sshd]
ARG BASE_IMAGE_TAG
# ================================================================
FROM suisrc/openresty:1.27.1.2-hd-1 as openresty-stage
FROM ghcr.io/suisrc/webtop:s6-${BASE_IMAGE_TAG}
# ================================================================
# copy openresty
COPY --from=openresty-stage /usr/local/openresty /usr/local/openresty
COPY --from=openresty-stage /etc/nginx /etc/nginx
# copy rootfs all file
COPY rootfs/ /
# ================================================================
# set environment variables
ENV LANGUAGE="zh_CN.UTF-8" \
LANG="zh_CN.UTF-8" \
USER="debian" \
HOME="/home/debian" \
SVC_SSHD="1" \
SVC_NGINX="1" \
ZSH_CUSTOM="/home/debian/.oh-my-zsh/plugins"
# update linux
RUN mkdir /var/run/openresty &&\
ln -s /usr/local/openresty/nginx/sbin/nginx /usr/bin/nginx && \
ln -s /usr/local/openresty/nginx/html /www &&\
apt update && DEBIAN_FRONTEND=noninteractive \
apt install --no-install-recommends -y \
dpkg \
sudo \
bash \
zsh \
curl \
wget \
ca-certificates \
jq \
git \
unzip \
p7zip \
xz-utils \
nano \
procps \
iproute2 \
net-tools \
ntpdate \
iputils-ping \
locales \
libpcre3 \
inotify-tools \
tzdata \
util-linux \
ssl-cert \
openssl \
openssh-client \
openssh-server \
python3 \
gcc \
binutils \
libxfont2 \
libdbus-glib-1-2 \
libatomic1 \
build-essential \
libz-dev \
zlib1g-dev \
fontconfig \
fonts-noto-core \
fonts-noto-cjk \
fonts-noto-color-emoji &&\
fc-cache -f -v && \
locale-gen zh_CN.UTF-8 && \
apt-get autoremove && apt-get clean && \
rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/*
# creating the user and usergroup
RUN groupadd --gid 1000 $USER && \
useradd --uid 1000 --gid $USER -d $HOME -m -s /bin/bash $USER && \
echo $USER ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USER && \
chmod 0440 /etc/sudoers.d/$USER && chmod g+rw /home && \
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" &&\
git clone --depth 1 "https://github.com/zsh-users/zsh-autosuggestions" "${ZSH_CUSTOM}/zsh-autosuggestions" &&\
echo "source ${ZSH_CUSTOM}/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.zshrc &&\
sed -i "1iZSH_DISABLE_COMPFIX=true" ~/.zshrc && sed -i -e "1iHOME=${HOME}" -e "2isource /etc/profile" /root/.bashrc &&\
sed -i "3iexport \$(sudo cat /proc/1/environ |tr '\\\\0' '\\\\n' | xargs)" /etc/profile
# /etc/profile
# ssh 连接会导致环境变量消失, 在docker中,可以通过进程ID=1上的环境变量还原, 通过profile文件还原
# EXPOSE 22 80 443
WORKDIR $HOME