Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +16 -48
Dockerfile
CHANGED
|
@@ -4,61 +4,29 @@ FROM ubuntu:22.04
|
|
| 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 |
-
# This
|
| 15 |
-
|
| 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 "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
# 5.
|
|
|
|
|
|
|
| 63 |
EXPOSE 7860
|
| 64 |
-
CMD ["ttyd", "-p", "7860", "-W", "--
|
|
|
|
| 4 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 5 |
WORKDIR /root
|
| 6 |
|
| 7 |
+
# 2. Install everything you need for PC-level power
|
| 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. TMUX CONFIG (The Magic)
|
| 14 |
+
# This makes the status bar at the bottom act like "Tabs"
|
| 15 |
+
# You can TAP the names to switch between them!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 "set -g status-interval 1" >> /root/.tmux.conf && \
|
| 20 |
+
echo "set -g status-left '#[fg=green][#S] '" >> /root/.tmux.conf && \
|
| 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. LAUNCH AS ROOT
|
| 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 |
+
CMD ["ttyd", "-p", "7860", "-W", "--ping-interval", "5", "--check-origin", "false", "tmux", "new", "-A", "-s", "main"]
|