-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
46 lines (38 loc) · 1.5 KB
/
Dockerfile
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
FROM ubuntu:bionic
LABEL maintainer="Christophe Burki, christophe.burki@protonmail.ch"
# Install system requirements
RUN apt-get update && apt-get install -y --no-install-recommends \
emacs25-nox \
locales \
openssh-server \
pwgen \
tmux \
tzdata \
xterm && \
apt-get autoremove -y && \
apt-get clean
# Configure locales and timezone
RUN locale-gen en_US.UTF-8 en_GB.UTF-8 fr_CH.UTF-8 && \
cp /usr/share/zoneinfo/Europe/Zurich /etc/localtime && \
echo "Europe/Zurich" > /etc/timezone
RUN mkdir /var/run/sshd && \
sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config && \
sed -ri 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config && \
sed -ri 's/PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config && \
mkdir /root/.ssh
# s6 install and config
COPY bin/* /usr/bin/
COPY configs/etc/s6 /etc/s6/
RUN chmod a+x /usr/bin/s6-* && \
chmod a+x /etc/s6/.s6-svscan/finish /etc/s6/sshd/run /etc/s6/sshd/finish
# install setup scripts
COPY scripts/* /opt/
RUN chmod a+x /opt/setupusers.sh
# setup shell environment
COPY configs/tmux/tmux.conf /root/.tmux.conf
RUN echo 'PAGER=less' >> /root/.bashrc && \
echo 'TERM=xterm' >> /root/.bashrc && \
echo 'PS1="\[\e[32m\]\u\[\e[m\]\[\e[32m\]@\[\e[m\]\[\e[32m\]\h\[\e[m\]\[\e[32m\]:\[\e[m\]\[\e[34m\]\W\[\e[m\] \[\e[34m\]\\$\[\e[m\] "' >> /root/.bashrc && \
echo '#[ -z "$TMUX" ] && command -v tmux > /dev/null && tmux && exit 0' >> /root/.bashrc
EXPOSE 22
CMD ["/usr/bin/s6-svscan", "/etc/s6"]