Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +48 -17
Dockerfile
CHANGED
|
@@ -1,32 +1,63 @@
|
|
| 1 |
FROM ubuntu:22.04
|
| 2 |
|
| 3 |
-
# 1.
|
| 4 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 5 |
WORKDIR /root
|
| 6 |
|
| 7 |
-
# 2. Install
|
| 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.
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
RUN echo "set -g mouse on" > /root/.tmux.conf && \
|
| 17 |
echo "set -g status-bg black" >> /root/.tmux.conf && \
|
| 18 |
echo "set -g status-fg cyan" >> /root/.tmux.conf && \
|
| 19 |
-
echo "
|
| 20 |
-
echo "
|
| 21 |
-
echo "set -g status-right '#[fg=yellow]TABS: #I '" >> /root/.tmux.conf
|
| 22 |
-
|
| 23 |
-
# 4. Quality of Life Aliases
|
| 24 |
-
RUN echo "alias pkg='apt'" >> /root/.bashrc && \
|
| 25 |
-
echo "alias python='python3'" >> /root/.bashrc && \
|
| 26 |
-
echo "alias pip='pip3'" >> /root/.bashrc
|
| 27 |
|
| 28 |
-
# 5.
|
| 29 |
-
# --ping-interval 5: Keeps the connection alive while tab is open
|
| 30 |
-
# --check-origin false: Stops security errors on some mobile browsers
|
| 31 |
EXPOSE 7860
|
| 32 |
-
|
|
|
|
|
|
|
|
|
| 1 |
FROM ubuntu:22.04
|
| 2 |
|
| 3 |
+
# 1. Environment Setup
|
| 4 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 5 |
WORKDIR /root
|
| 6 |
|
| 7 |
+
# 2. Install PC Power Tools
|
| 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 Custom Web UI (Terminal in UI, Buttons outside)
|
| 14 |
+
RUN echo '<!DOCTYPE html>\
|
| 15 |
+
<html>\
|
| 16 |
+
<head>\
|
| 17 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">\
|
| 18 |
+
<style>\
|
| 19 |
+
body { margin: 0; padding: 0; display: flex; flex-direction: column; height: 100vh; background: #000; overflow: hidden; }\
|
| 20 |
+
#terminal-container { flex: 1; position: relative; }\
|
| 21 |
+
iframe { width: 100%; height: 100%; border: none; }\
|
| 22 |
+
.button-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; background: #111; border-top: 1px solid #333; z-index: 10; }\
|
| 23 |
+
button { flex: 1; min-width: 60px; background: #222; color: #00e5ff; border: 1px solid #444; padding: 12px 2px; \
|
| 24 |
+
border-radius: 4px; font-size: 11px; font-weight: bold; text-transform: uppercase; }\
|
| 25 |
+
button:active { background: #00e5ff; color: #000; }\
|
| 26 |
+
</style>\
|
| 27 |
+
</head>\
|
| 28 |
+
<body>\
|
| 29 |
+
<div id="terminal-container">\
|
| 30 |
+
\
|
| 31 |
+
<iframe id="ttyd-frame" src="./token"></iframe>\
|
| 32 |
+
</div>\
|
| 33 |
+
<div class="button-bar">\
|
| 34 |
+
<button onclick="sendKey(\"\\x02c\")">New Tab</button>\
|
| 35 |
+
<button onclick="sendKey(\"\\x02n\")">Next</button>\
|
| 36 |
+
<button onclick="sendKey(\"\\x02p\")">Prev</button>\
|
| 37 |
+
<button onclick="sendKey(\"\\x02[\")">Scroll</button>\
|
| 38 |
+
<button onclick="sendKey(\"\\x1b\")">ESC</button>\
|
| 39 |
+
<button onclick="sendKey(\"\\t\")">TAB</button>\
|
| 40 |
+
<button onclick="location.reload()">Reset</button>\
|
| 41 |
+
</div>\
|
| 42 |
+
<script>\
|
| 43 |
+
function sendKey(key) {\
|
| 44 |
+
const frame = document.getElementById("ttyd-frame");\
|
| 45 |
+
/* We use postMessage to talk to the ttyd instance inside the frame */\
|
| 46 |
+
frame.contentWindow.postMessage({ type: "input", data: key }, "*");\
|
| 47 |
+
}\
|
| 48 |
+
</script>\
|
| 49 |
+
</body>\
|
| 50 |
+
</html>' > /root/index.html
|
| 51 |
+
|
| 52 |
+
# 4. Tmux & Termux Aliases
|
| 53 |
RUN echo "set -g mouse on" > /root/.tmux.conf && \
|
| 54 |
echo "set -g status-bg black" >> /root/.tmux.conf && \
|
| 55 |
echo "set -g status-fg cyan" >> /root/.tmux.conf && \
|
| 56 |
+
echo "alias pkg='apt'" >> /root/.bashrc && \
|
| 57 |
+
echo "alias python='python3'" >> /root/.bashrc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
+
# 5. Launch with "Anti-Spam" heartbeat and custom UI
|
|
|
|
|
|
|
| 60 |
EXPOSE 7860
|
| 61 |
+
# --ping-interval 2: Keeps connection alive every 2 seconds to stop the loop
|
| 62 |
+
# --index /root/index.html: Uses our custom UI instead of the default one
|
| 63 |
+
CMD ["ttyd", "-p", "7860", "-W", "--index", "/root/index.html", "--ping-interval", "2", "--check-origin", "false", "tmux", "new", "-A", "-s", "main"]
|