-
Notifications
You must be signed in to change notification settings - Fork 142
/
Copy pathDockerfile
31 lines (26 loc) · 1.36 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
# You can change the base image to any other image you want.
FROM catub/core:bullseye
ARG AUTH_TOKEN
ARG PASSWORD=rootuser
# Install packages and set locale
RUN apt-get update \
&& apt-get install -y locales nano ssh sudo python3 curl wget \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \
&& rm -rf /var/lib/apt/lists/*
# Configure SSH tunnel using ngrok
ENV DEBIAN_FRONTEND=noninteractive \
LANG=en_US.utf8
RUN wget -O ngrok.zip https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.zip \
&& unzip ngrok.zip \
&& rm /ngrok.zip \
&& mkdir /run/sshd \
&& echo "/ngrok tcp --authtoken ${AUTH_TOKEN} 22 &" >>/docker.sh \
&& echo "sleep 5" >> /docker.sh \
&& echo "curl -s http://localhost:4040/api/tunnels | python3 -c \"import sys, json; print(\\\"SSH Info:\\\n\\\",\\\"ssh\\\",\\\"root@\\\"+json.load(sys.stdin)['tunnels'][0]['public_url'][6:].replace(':', ' -p '),\\\"\\\nROOT Password:${PASSWORD}\\\")\" || echo \"\nError:AUTH_TOKEN,Reset ngrok token & try\n\"" >> /docker.sh \
&& echo '/usr/sbin/sshd -D' >>/docker.sh \
&& echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config \
&& echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config \
&& echo root:${PASSWORD}|chpasswd \
&& chmod 755 /docker.sh
EXPOSE 80 8888 8080 443 5130-5135 3306 7860
CMD ["/bin/bash", "/docker.sh"]