proti0070 commited on
Commit
c8b7f89
·
verified ·
1 Parent(s): 0e547ac

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +52 -0
  2. nginx.conf +14 -0
  3. start.sh +58 -0
Dockerfile ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM kalilinux/kali-rolling
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+ ENV HOSTNAME=xro
5
+
6
+ RUN apt-get update && apt-get install -y \
7
+ ca-certificates \
8
+ curl \
9
+ wget \
10
+ git \
11
+ sudo \
12
+ htop \
13
+ btop \
14
+ neovim \
15
+ nano \
16
+ tmux \
17
+ screen \
18
+ lsof \
19
+ net-tools \
20
+ nmap \
21
+ netcat-traditional \
22
+ whois \
23
+ dnsutils \
24
+ python3 \
25
+ python3-pip \
26
+ nodejs \
27
+ npm \
28
+ nginx \
29
+ && rm -rf /var/lib/apt/lists/*
30
+
31
+ # ---- Node v20 ----
32
+ RUN npm install -g n && \
33
+ n 22 && \
34
+ hash -r
35
+
36
+ # ---- OpenClaw ----
37
+ RUN npm install -g openclaw@latest
38
+
39
+ # ---- ttyd ----
40
+ RUN curl -fsSL https://github.com/tsl0922/ttyd/releases/download/1.7.4/ttyd.x86_64 \
41
+ -o /usr/local/bin/ttyd && chmod +x /usr/local/bin/ttyd
42
+
43
+ WORKDIR /workspace
44
+
45
+ COPY start.sh /start.sh
46
+ COPY nginx.conf /etc/nginx/sites-enabled/default
47
+ RUN chmod +x /start.sh
48
+
49
+ EXPOSE 7860
50
+
51
+
52
+ CMD ["/start.sh"]
nginx.conf ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ server {
2
+ listen 7860;
3
+
4
+ # Root e terminal
5
+ location / {
6
+ proxy_pass http://127.0.0.1:8080/;
7
+ proxy_http_version 1.1;
8
+ proxy_set_header Upgrade $http_upgrade;
9
+ proxy_set_header Connection "upgrade";
10
+ proxy_set_header Host $host;
11
+ proxy_read_timeout 86400;
12
+ proxy_send_timeout 86400;
13
+ }
14
+ }
start.sh ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ mkdir -p /run/dbus
4
+ dbus-daemon --system --fork 2>/dev/null || true
5
+
6
+ export PATH=$PATH:/usr/local/bin
7
+
8
+ # OpenClaw config
9
+ mkdir -p ~/.config/openclaw
10
+ cat > ~/.config/openclaw/config.json << 'EOF'
11
+ {
12
+ "gateway": {
13
+ "mode": "local",
14
+ "port": 9000,
15
+ "bind": "lan"
16
+ }
17
+ }
18
+ EOF
19
+
20
+ echo "=== Starting OpenClaw Gateway (background) ==="
21
+ while true; do
22
+ openclaw gateway --port 9000 --bind lan --allow-unconfigured
23
+ sleep 10
24
+ done &
25
+
26
+ sleep 5
27
+
28
+ echo "=== Starting ttyd terminal ==="
29
+ ttyd \
30
+ --port 8080 \
31
+ --interface 127.0.0.1 \
32
+ --writable \
33
+ bash &
34
+ TTYD_PID=$!
35
+
36
+ sleep 3
37
+
38
+ echo "=== Starting nginx ==="
39
+ nginx -g "daemon off;" &
40
+ NGINX_PID=$!
41
+
42
+ echo "
43
+ ✅ Terminal: your-space.hf.space/
44
+ 🤖 OpenClaw: port 9000 (background)
45
+ "
46
+
47
+ # Keep alive
48
+ while true; do
49
+ if ! kill -0 $TTYD_PID 2>/dev/null; then
50
+ ttyd --port 8080 --interface 127.0.0.1 --writable bash &
51
+ TTYD_PID=$!
52
+ fi
53
+ if ! kill -0 $NGINX_PID 2>/dev/null; then
54
+ nginx -g "daemon off;" &
55
+ NGINX_PID=$!
56
+ fi
57
+ sleep 10
58
+ done