dracoox commited on
Commit
ccfca00
·
verified ·
1 Parent(s): 81cc88d

Create Dockerfile

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