forked from sorryforhateyou/gost-heroku
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitpod.dockerfile
97 lines (88 loc) · 6.45 KB
/
.gitpod.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
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
91
92
93
94
95
96
97
FROM gitpod/workspace-full:latest
USER root
# Install Xvfb, JavaFX-helpers and Openbox window manager
RUN add-apt-repository ppa:no1wantdthisname/ppa && apt-get update && apt-get -y upgrade \
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq language-pack-zh-hans-base xvfb x11vnc xterm megatools fonts-droid-fallback fonts-wqy-microhei fluxbox blackbox firefox firefox-locale-zh-hans lxterminal pcmanfm mousepad vim-nox emacs-nox aria2 \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo 'Asia/Shanghai' >/etc/timezone
# overwrite this env variable to use a different window manager
ENV LANG="zh_CN.UTF-8"
ENV WINDOW_MANAGER="fluxbox"
# Install novnc
RUN git clone https://github.com/novnc/noVNC.git /opt/novnc \
&& git clone https://github.com/novnc/websockify /opt/novnc/utils/websockify
RUN curl -O -L https://github.com/xuiv/gost-heroku/releases/download/1.01/gost-linux \
&& curl -O -L https://github.com/xuiv/v2ray-heroku/releases/download/1.01/v2ray-linux \
&& curl -O -L https://github.com/xuiv/v2ray-heroku/releases/download/1.01/server.json \
&& curl -o - -L https://github.com/hyxf/webui/releases/download/1.0.0/webui-linux.gz | gunzip > webui-linux \
&& mv gost-linux /usr/bin/ \
&& mv v2ray-linux /usr/bin/ \
&& mv server.json /usr/bin/ \
&& mv webui-linux /usr/bin/ \
&& chmod +x /usr/bin/gost-linux \
&& chmod +x /usr/bin/v2ray-linux \
&& chmod 644 /usr/bin/server.json \
&& chmod +x /usr/bin/webui-linux
RUN curl -O -L https://raw.githubusercontent.com/gitpod-io/workspace-images/master/full-vnc/novnc-index.html \
&& curl -O -L https://raw.githubusercontent.com/gitpod-io/workspace-images/master/full-vnc/start-vnc-session.sh \
&& mv novnc-index.html /opt/novnc/index.html \
&& mv start-vnc-session.sh /usr/bin/ \
&& chmod +x /usr/bin/start-vnc-session.sh \
&& sed -ri "s/1920x1080/1366x830/g" /usr/bin/start-vnc-session.sh \
&& sed -ri "s/Bitstream Vera Sans-9/WenQuanYi Micro Hei Mono-10/g" /usr/share/blackbox/styles/Gray \
&& sed -ri "s/Bitstream Vera Sans-9/WenQuanYi Micro Hei Mono-10/g" /usr/share/blackbox/styles/Green \
&& sed -ri "s/Bitstream Vera Sans-9/WenQuanYi Micro Hei Mono-10/g" /usr/share/blackbox/styles/Blue \
&& sed -ri "s/Bitstream Vera Sans-9/WenQuanYi Micro Hei Mono-10/g" /usr/share/blackbox/styles/Purple \
&& sed -ri "s/Bitstream Vera Sans-9/WenQuanYi Micro Hei Mono-10/g" /usr/share/blackbox/styles/Red \
&& sed -ri '/Automatically generated/a\ \[exec\] \(Xterm\) \{ x-terminal-emulator -T "Bash" -e /bin/bash --login\} \<\>' /etc/X11/fluxbox/fluxbox-menu \
&& sed -ri '/Automatically generated/a\ \[exec\] \(LXterm\) \{lxterminal\} \<\>' /etc/X11/fluxbox/fluxbox-menu \
&& sed -ri '/Automatically generated/a\ \[exec\] \(Filemanager\) \{pcmanfm\} \<\>' /etc/X11/fluxbox/fluxbox-menu \
&& sed -ri '/Automatically generated/a\ \[exec\] \(Deluge\) \{deluge-gtk\} \<\>' /etc/X11/fluxbox/fluxbox-menu \
&& sed -ri '/Automatically generated/a\ \[exec\] \(Mousepad\) \{mousepad\} \<\>' /etc/X11/fluxbox/fluxbox-menu \
&& sed -ri '/Automatically generated/a\ \[exec\] \(Firefox\) \{firefox\} \<\>' /etc/X11/fluxbox/fluxbox-menu \
&& mv /etc/X11/blackbox/blackbox-menu /etc/X11/blackbox/blackbox-menu.orig \
&& echo "[begin] (Menu)" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [exec] (Firefox) {firefox}" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [exec] (Mousepad) {mousepad}" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [exec] (Deluge) {deluge-gtk}" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [exec] (Filemanager) {pcmanfm}" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [exec] (LXterm) {lxterminal}" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [sep]" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [config] (Configuration)" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [submenu] (Styles)" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [stylesdir] (/usr/share/blackbox/styles)" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [end]" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [workspaces] (Workspaces)" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [sep]" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [submenu] (Window Managers)" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [restart] (Blackbox) {/usr/bin/blackbox}" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [restart] (FluxBox) {/usr/bin/startfluxbox}" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [end]" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [reconfig] (Reconfigure)" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [restart] (Restart)" >> /etc/X11/blackbox/blackbox-menu \
&& echo " [exit] (Exit)" >> /etc/X11/blackbox/blackbox-menu \
&& echo "[end]" >> /etc/X11/blackbox/blackbox-menu
# This is a bit of a hack. At the moment we have no means of starting background
# tasks from a Dockerfile. This workaround checks, on each bashrc eval, if the X
# server is running on screen 0, and if not starts Xvfb, x11vnc and novnc.
RUN echo "export PORT=1080" >> ~/.bashrc \
&& echo "export DISPLAY=:0" >> ~/.bashrc \
&& echo "" >> ~/.bashrc \
&& echo "vvv=\`pstree |grep gost\`" >> ~/.bashrc \
&& echo "if [ \"\${vvv}\"x = \"\"x ]" >> ~/.bashrc \
&& echo "then" >> ~/.bashrc \
&& echo " nohup gost-linux -L quic+ws://:1081 >/dev/null 2>&1 &" >> ~/.bashrc \
&& echo " sudo mount -t tmpfs -o size=20g tmpfs /mnt" >> ~/.bashrc \
&& echo " pushd /tmp && curl -O -L https://raw.githubusercontent.com/xuiv/xuiv.github.io/master/aria2.conf && bash <(curl -fsSL git.io/tracker.sh) && popd" >> ~/.bashrc \
&& echo " nohup aria2c --dir /mnt --enable-rpc --rpc-listen-all --listen-port=8088 --enable-dht=true --dht-listen-port=8088 -c --conf-path=/tmp/aria2.conf -D >/dev/null 2>&1 &" >> ~/.bashrc \
&& echo " nohup webui-linux --port 8080 >/dev/null 2>&1 &" >> ~/.bashrc \
&& echo " nohup v2ray-linux -config /usr/bin/server.json >/dev/null 2>&1 &" >> ~/.bashrc \
&& echo " [ ! -e /tmp/.X0-lock ] && (nohup /usr/bin/start-vnc-session.sh &> /tmp/display-\${DISPLAY}.log >/dev/null 2>&1 &)" >> ~/.bashrc \
&& echo "fi" >> ~/.bashrc \
&& rm -rf ~/.mozilla && curl -o - -L https://raw.githubusercontent.com/xuiv/xuiv.github.io/master/firefox.tar.gz | tar -zx -C ~
### checks ###
# no root-owned files in the home directory
RUN notOwnedFile=$(find . -not "(" -user gitpod -and -group gitpod ")" -print -quit) \
&& { [ -z "$notOwnedFile" ] \
|| { echo "Error: not all files/dirs in $HOME are owned by 'gitpod' user & group"; exit 1; } }