forked from AkashiCoin/Railway-Ngrok
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
19 lines (19 loc) · 1.09 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
FROM ubuntu
ARG NGROK_TOKEN
ARG REGION=jp
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y \
ssh wget unzip vim curl
RUN wget -q https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip -O /ngrok-stable-linux-amd64.zip\
&& cd / && unzip ngrok-stable-linux-amd64.zip \
&& chmod +x ngrok
RUN mkdir /run/sshd \
&& echo "/ngrok tcp --authtoken ${NGROK_TOKEN} --region ${REGION} 22 &" >>/openssh.sh \
&& echo "sleep 5" >> /openssh.sh \
&& echo "curl -s http://localhost:4040/api/tunnels | python3 -c \"import sys, json; print(\\\"ssh连接命令:\\\n\\\",\\\"ssh\\\",\\\"root@\\\"+json.load(sys.stdin)['tunnels'][0]['public_url'][6:].replace(':', ' -p '),\\\"\\\nROOT默认密码:akashi520\\\")\" || echo \"\nError:请检查NGROK_TOKEN变量是否存在,或Ngrok节点已被占用\n\"" >> /openssh.sh \
&& echo '/usr/sbin/sshd -D' >>/openssh.sh \
&& echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config \
&& echo root:akashi520|chpasswd \
&& chmod 755 /openssh.sh
EXPOSE 80 443 3306 4040 5432 5700 5701 5010 6800 6900 8080 8888 9000
CMD /openssh.sh