void0028 commited on
Commit
3fc86ae
·
verified ·
1 Parent(s): 7f33a2e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +55 -34
Dockerfile CHANGED
@@ -1,43 +1,64 @@
1
  FROM ubuntu:22.04
2
 
3
- # 1. Supress interactive prompts
4
  ENV DEBIAN_FRONTEND=noninteractive
 
5
 
6
- # 2. Install the basics PLUS 'tmux' (The Session Keeper)
7
- RUN apt-get update && \
8
- apt-get install -y \
9
- ttyd \
10
- tmux \
11
- bash \
12
- nano \
13
- vim \
14
- curl \
15
- wget \
16
- git \
17
- python3 \
18
- python3-pip \
19
- sudo \
20
- build-essential \
21
- net-tools \
22
- iputils-ping \
23
- htop \
24
- neofetch \
25
  && rm -rf /var/lib/apt/lists/*
26
 
27
- # 3. Aliases for muscle memory
28
- RUN echo "alias pkg='apt'" >> /root/.bashrc
29
- RUN echo "alias python='python3'" >> /root/.bashrc
30
- RUN echo "alias pip='pip3'" >> /root/.bashrc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
- # 4. Configure Tmux to look good (Optional but nice)
33
- # Enables mouse support so you can scroll inside the terminal
34
- RUN echo "set -g mouse on" > /root/.tmux.conf
 
 
35
 
36
- WORKDIR /root
37
  EXPOSE 7860
38
-
39
- # 5. THE MAGIC COMMAND
40
- # Instead of running 'bash', we run 'tmux'.
41
- # "new -A -s main" means:
42
- # "Create a session named 'main'. If 'main' already exists, ATTACH to it instead of creating a new one."
43
- CMD ["ttyd", "-p", "7860", "-W", "tmux", "new", "-A", "-s", "main"]
 
1
  FROM ubuntu:22.04
2
 
3
+ # 1. Setup Environment
4
  ENV DEBIAN_FRONTEND=noninteractive
5
+ WORKDIR /root
6
 
7
+ # 2. Install PC-grade tools + ttyd
8
+ RUN apt-get update && apt-get install -y \
9
+ ttyd tmux bash curl wget git python3 python3-pip sudo \
10
+ build-essential net-tools htop neofetch \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # 3. Create the Custom Mobile UI (index.html)
14
+ # This adds a button bar at the bottom that sends tmux commands
15
+ RUN echo '<!DOCTYPE html>\
16
+ <html>\
17
+ <head>\
18
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">\
19
+ <style>\
20
+ body { margin: 0; display: flex; flex-direction: column; height: 100vh; background: #000; color: #fff; font-family: sans-serif; }\
21
+ #terminal { flex: 1; overflow: hidden; }\
22
+ .controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; padding: 10px; background: #1a1a1a; border-top: 2px solid #333; }\
23
+ button { background: #333; color: #0cf; border: 1px solid #444; padding: 12px 5px; border-radius: 5px; font-size: 12px; font-weight: bold; active { background: #0cf; color: #000; } }\
24
+ </style>\
25
+ </head>\
26
+ <body>\
27
+ <div id="terminal"></div>\
28
+ <div class="controls">\
29
+ <button onclick="sendCmd(\"c\")">NEW TAB</button>\
30
+ <button onclick="sendCmd(\"n\")">NEXT</button>\
31
+ <button onclick="sendCmd(\"p\")">PREV</button>\
32
+ <button onclick="sendCmd(\"&\")">CLOSE</button>\
33
+ <button onclick="sendCmd(\"[\")">SCROLL</button>\
34
+ <button onclick="sendKey(\"TAB\")">TAB</button>\
35
+ <button onclick="sendKey(\"ESC\")">ESC</button>\
36
+ <button onclick="location.reload()">REFRESH</button>\
37
+ </div>\
38
+ <script src="client-bundle.js"></script>\
39
+ <script>\
40
+ var term = new TTYDTerm(document.getElementById("terminal"), { \
41
+ rendererType: "canvas", \
42
+ enableMouse: true \
43
+ });\
44
+ /* Magic: This sends the tmux prefix (Ctrl+B) followed by the key */ \
45
+ function sendCmd(k) { \
46
+ term.send("\\x02" + k); \
47
+ } \
48
+ function sendKey(k) { \
49
+ const keys = { "TAB": "\\t", "ESC": "\\x1b" }; \
50
+ term.send(keys[k]); \
51
+ } \
52
+ </script>\
53
+ </body>\
54
+ </html>' > /root/index.html
55
 
56
+ # 4. Configure Tmux for God Mode
57
+ RUN echo "set -g mouse on" > /root/.tmux.conf && \
58
+ echo "set -g status-bg black" >> /root/.tmux.conf && \
59
+ echo "set -g status-fg cyan" >> /root/.tmux.conf && \
60
+ echo "alias pkg='apt'" >> /root/.bashrc
61
 
62
+ # 5. Launch with the custom UI
63
  EXPOSE 7860
64
+ CMD ["ttyd", "-p", "7860", "-W", "--index", "/root/index.html", "tmux", "new", "-A", "-s", "main"]