dracoox commited on
Commit
1fe875c
·
verified ·
1 Parent(s): d0da32a

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +114 -0
Dockerfile ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 && \
14
+ chown -R Draco:Draco /home/Draco/.npm-global
15
+
16
+ # Install curl, gnupg, and add NodeSource Node.js 20 repo
17
+ RUN apt-get update && \
18
+ apt-get install -y curl gnupg && \
19
+ apt-get clean
20
+
21
+ RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -
22
+
23
+ # Install Node.js 20, ffmpeg, and required packages
24
+ RUN apt-get install -y --no-install-recommends \
25
+ nodejs \
26
+ ffmpeg \
27
+ python3 python3-pip python3-venv \
28
+ build-essential \
29
+ tmate \
30
+ openssh-client \
31
+ neofetch \
32
+ git \
33
+ wget \
34
+ vim \
35
+ nano \
36
+ unzip \
37
+ zip \
38
+ htop \
39
+ net-tools \
40
+ iputils-ping \
41
+ dnsutils \
42
+ tmux \
43
+ screen \
44
+ jq \
45
+ ca-certificates \
46
+ software-properties-common \
47
+ sqlite3 \
48
+ libsqlite3-dev \
49
+ libssl-dev \
50
+ libffi-dev \
51
+ libxml2-dev \
52
+ libxslt1-dev \
53
+ libjpeg-dev \
54
+ zlib1g-dev \
55
+ libpng-dev \
56
+ libwebp-dev \
57
+ pkg-config \
58
+ rsync \
59
+ lsof \
60
+ sudo \
61
+ gnupg \
62
+ openssl \
63
+ tree \
64
+ mc \
65
+ python3-dev \
66
+ python3-distutils \
67
+ python3-setuptools \
68
+ cron \
69
+ aria2 \
70
+ telnet \
71
+ expect && \
72
+ apt-get clean && \
73
+ rm -rf /var/lib/apt/lists/*
74
+
75
+ # Install Python packages globally
76
+ RUN pip3 install --no-cache-dir \
77
+ pytelegrambotapi \
78
+ requests \
79
+ beautifulsoup4 \
80
+ lxml \
81
+ flask \
82
+ httpx \
83
+ aiohttp \
84
+ schedule
85
+
86
+ # Generate SSH keys for tmate (root)
87
+ RUN mkdir -p /root/.ssh && \
88
+ ssh-keygen -t rsa -f /root/.ssh/id_rsa -N '' && \
89
+ chmod 700 /root/.ssh && \
90
+ chmod 600 /root/.ssh/id_rsa
91
+
92
+ # Create /dev/ptmx if missing to avoid crashes (permission 666)
93
+ RUN if [ ! -c /dev/ptmx ]; then \
94
+ mknod /dev/ptmx c 5 2 && chmod 666 /dev/ptmx ; \
95
+ fi
96
+
97
+ # Create /dev/pts directory (empty, since mounting devpts is not possible here)
98
+ RUN mkdir -p /dev/pts
99
+
100
+ # Prepare /app directory owned by Draco
101
+ RUN mkdir -p /app && \
102
+ echo "Tmate Session Running..." > /app/index.html && \
103
+ chown -R Draco:Draco /app
104
+
105
+ WORKDIR /app
106
+
107
+ # Switch to Draco user
108
+ USER Draco
109
+
110
+ # Verify important versions (optional)
111
+ RUN node -v && npm -v && python3 --version && ffmpeg -version
112
+
113
+ # Use tmate -F foreground, no background, ignore terminal errors to avoid crash
114
+ CMD python3 -m http.server 7860 & tmate -F || echo "tmate exited or failed"