dracoox commited on
Commit
c265acc
·
verified ·
1 Parent(s): 311b7b7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +83 -102
Dockerfile CHANGED
@@ -1,104 +1,85 @@
1
  FROM ubuntu:22.04
2
 
3
- ENV DEBIAN_FRONTEND=noninteractive
4
- ENV TERM=xterm-256color
5
- ENV NPM_CONFIG_PREFIX=/home/Draco/.npm-global
6
- ENV PATH=$PATH:/home/Draco/.npm-global/bin
7
-
8
- # Create sudoers.d directory, user Draco with passwordless sudo and npm global folder
9
- RUN mkdir -p /etc/sudoers.d && \
10
- useradd -m -u 1000 -s /bin/bash Draco && \
11
- echo "Draco ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/draco && \
12
- chmod 440 /etc/sudoers.d/draco && \
13
- mkdir -p /home/Draco/.npm-global && chown -R Draco:Draco /home/Draco/.npm-global
14
-
15
- # Install curl, gnupg, and add NodeSource Node.js 20 repo
16
- RUN apt-get update && apt-get install -y curl gnupg && apt-get clean
17
- RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -
18
-
19
- # Install Node.js, Tailscale, Python, and tools (no tmate)
20
- RUN apt-get update && apt-get install -y --no-install-recommends \
21
- nodejs \
22
- ffmpeg \
23
- python3 python3-pip python3-venv \
24
- build-essential \
25
- openssh-client \
26
- neofetch \
27
- git \
28
- wget \
29
- vim \
30
- nano \
31
- unzip \
32
- zip \
33
- htop \
34
- net-tools \
35
- iputils-ping \
36
- dnsutils \
37
- tmux \
38
- screen \
39
- jq \
40
- ca-certificates \
41
- software-properties-common \
42
- sqlite3 \
43
- libsqlite3-dev \
44
- libssl-dev \
45
- libffi-dev \
46
- libxml2-dev \
47
- libxslt1-dev \
48
- libjpeg-dev \
49
- zlib1g-dev \
50
- libpng-dev \
51
- libwebp-dev \
52
- pkg-config \
53
- rsync \
54
- lsof \
55
- sudo \
56
- gnupg \
57
- openssl \
58
- tree \
59
- mc \
60
- python3-dev \
61
- python3-distutils \
62
- python3-setuptools \
63
- cron \
64
- aria2 \
65
- telnet \
66
- expect && \
67
- apt-get clean && rm -rf /var/lib/apt/lists/*
68
-
69
- # Install Python packages globally
70
- RUN pip3 install --no-cache-dir \
71
- pytelegrambotapi \
72
- requests \
73
- beautifulsoup4 \
74
- lxml \
75
- flask \
76
- httpx \
77
- aiohttp \
78
- schedule
79
-
80
- # Install Tailscale
81
- RUN curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.gpg | tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null && \
82
- curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.list | tee /etc/apt/sources.list.d/tailscale.list >/dev/null && \
83
- apt-get update && apt-get install -y tailscale && \
84
- apt-get clean && rm -rf /var/lib/apt/lists/*
85
-
86
- # Create app directory
87
- RUN mkdir -p /app && echo "Server is running..." > /app/index.html && \
88
- chown -R Draco:Draco /app
89
-
90
- WORKDIR /app
91
-
92
- # Switch to Draco user
93
- USER Draco
94
-
95
- # Show key version numbers
96
- RUN node -v && npm -v && python3 --version && ffmpeg -version
97
-
98
- # Expose HTTP server port
99
- EXPOSE 7860
100
-
101
- # Start Python HTTP server and Tailscale userspace daemon
102
- CMD python3 -m http.server 7860 & \
103
- tailscaled --tun=userspace-networking --socks5-server=localhost:1055 > /dev/null 2>&1 & \
104
- sleep 3 && tailscale up --ssh --netfilter-mode=off || echo "tailscale failed"
 
1
  FROM ubuntu:22.04
2
 
3
+ ENV DEBIAN_FRONTEND=noninteractive LANG=en_US.UTF-8
4
+
5
+ Install system packages including LXDE and XRDP
6
+
7
+ RUN apt update && apt upgrade -y &&
8
+ apt install -y
9
+ sudo
10
+ curl
11
+ wget
12
+ git
13
+ gnupg
14
+ openssh-client
15
+ neofetch
16
+ tmate
17
+ python3
18
+ python3-pip
19
+ ca-certificates
20
+ software-properties-common
21
+ build-essential
22
+ procps
23
+ xz-utils
24
+ net-tools
25
+ make
26
+ ffmpeg
27
+ nano
28
+ vim
29
+ htop
30
+ unzip
31
+ zip
32
+ iputils-ping
33
+ tree
34
+ lsof
35
+ netcat
36
+ tmux
37
+ locales
38
+ lxde
39
+ xrdp &&
40
+ locale-gen en_US.UTF-8 &&
41
+ apt clean && rm -rf /var/lib/apt/lists/*
42
+
43
+ Configure XRDP to use LXDE session
44
+
45
+ RUN sed -i 's|port=3389|port=3389|g' /etc/xrdp/xrdp.ini &&
46
+ echo "lxsession -s LXDE -e LXDE" > /etc/xrdp/startwm.sh &&
47
+ chmod +x /etc/xrdp/startwm.sh
48
+
49
+ Install Node.js v22 and npm
50
+
51
+ RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - &&
52
+ apt update && apt install -y nodejs &&
53
+ npm install -g npm &&
54
+ apt clean && rm -rf /var/lib/apt/lists/*
55
+
56
+ Install speedtest-cli
57
+
58
+ RUN pip3 install --no-cache-dir speedtest-cli
59
+
60
+ Create user 'draco' with sudo rights and fixed UID
61
+
62
+ RUN useradd -m -s /bin/bash -u 1000 draco &&
63
+ echo "draco:draco" | chpasswd &&
64
+ usermod -aG sudo draco
65
+
66
+ Setup SSH keys for draco user
67
+
68
+ RUN mkdir -p /home/draco/.ssh &&
69
+ ssh-keygen -t rsa -f /home/draco/.ssh/id_rsa -N '' &&
70
+ chown -R draco:draco /home/draco/.ssh
71
+
72
+ USER draco WORKDIR /home/draco
73
+
74
+ Create tmate auto-reconnect launcher
75
+
76
+ RUN cat << 'EOF' > run_tmate.sh #!/bin/bash while true; do echo "[tmate-log] Launching new tmate session..." | tee tmate.txt tmate -S /tmp/tmate.sock new-session -d tmate -S /tmp/tmate.sock wait tmate-ready echo "[tmate-log] SSH: $(tmate -S /tmp/tmate.sock display -p "#{tmate_ssh}")" | tee -a tmate.txt echo "[tmate-log] Web: $(tmate -S /tmp/tmate.sock display -p "#{tmate_web}")" | tee -a tmate.txt echo "[tmate-log] Monitoring connection..." | tee -a tmate.txt while pgrep -f "tmate -S /tmp/tmate.sock" > /dev/null; do sleep 5; done echo "[tmate-log] ⚠️ Connection lost. Reconnecting in 5 seconds..." | tee -a tmate.txt sleep 5 done EOF RUN chmod +x run_tmate.sh
77
+
78
+ Expose RDP and Hugging Face web port
79
+
80
+ EXPOSE 3389 7890
81
+
82
+ Start tmate loop and simple HTTP server on port 7890
83
+
84
+ CMD ["bash", "-c", "./run_tmate.sh & python3 -m http.server 7890"]
85
+