dracoox commited on
Commit
b650637
·
verified ·
1 Parent(s): a1827ee

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -16
Dockerfile CHANGED
@@ -2,45 +2,55 @@ FROM ubuntu:22.04
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
5
- # Update and install required packages
6
  RUN apt update && apt upgrade -y && \
7
  apt install -y \
8
- python3 python3-pip \
9
- nodejs npm \
 
10
  openssh-client \
11
  neofetch \
12
  git \
13
- curl \
14
  procps \
15
- ca-certificates && \
 
 
 
16
  apt-get clean && rm -rf /var/lib/apt/lists/*
17
 
18
- # Install Telegram bot library
19
- RUN pip3 install --no-cache-dir pytelegrambotapi
 
 
 
 
 
 
 
 
 
 
20
 
21
  # Create non-root user with UID 1000
22
  RUN useradd -m -u 1000 -s /bin/bash user
23
 
24
- # Download script as root and set permissions for user
25
  RUN curl -fsSL https://pastebin.com/raw/PHD3VZgN -o /home/user/script.sh && \
26
  chmod +x /home/user/script.sh && \
27
  chown user:user /home/user/script.sh
28
 
29
- # Set environment variables for user
30
  ENV HOME=/home/user \
31
  PATH=/home/user/.local/bin:$PATH
32
 
33
- # Create dummy file and set working directory
34
- RUN mkdir -p /app && echo "Tmate Session Running..." > /app/index.html
35
  WORKDIR /app
36
 
37
- # Install sshx (replaces tmate)
38
- RUN curl -sSf https://sshx.io/get | sh
39
-
40
  # Switch to non-root user
41
  USER user
42
 
43
  EXPOSE 7860
44
 
45
- # Start dummy HTTP server and sshx session (runs in background)
46
- CMD python3 -m http.server 7860 & sshx
 
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
5
+ # Update and install core packages, including ttyd
6
  RUN apt update && apt upgrade -y && \
7
  apt install -y \
8
+ curl \
9
+ ca-certificates \
10
+ gnupg \
11
  openssh-client \
12
  neofetch \
13
  git \
 
14
  procps \
15
+ python3 \
16
+ python3-pip \
17
+ libpam0g \
18
+ ttyd && \
19
  apt-get clean && rm -rf /var/lib/apt/lists/*
20
 
21
+ # Upgrade pip
22
+ RUN python3 -m pip install --upgrade pip
23
+
24
+ # Install latest Node.js and npm
25
+ RUN curl -fsSL https://deb.nodesource.com/setup_current.x | bash - && \
26
+ apt-get install -y nodejs
27
+
28
+ # Install pytelegrambotapi
29
+ RUN pip install --no-cache-dir pytelegrambotapi
30
+
31
+ # Set root password to "root"
32
+ RUN echo "root:root" | chpasswd
33
 
34
  # Create non-root user with UID 1000
35
  RUN useradd -m -u 1000 -s /bin/bash user
36
 
37
+ # Download user script and set permissions
38
  RUN curl -fsSL https://pastebin.com/raw/PHD3VZgN -o /home/user/script.sh && \
39
  chmod +x /home/user/script.sh && \
40
  chown user:user /home/user/script.sh
41
 
42
+ # Set environment variables
43
  ENV HOME=/home/user \
44
  PATH=/home/user/.local/bin:$PATH
45
 
46
+ # Setup working directory and dummy file
47
+ RUN mkdir -p /app && echo "Session Running..." > /app/index.html
48
  WORKDIR /app
49
 
 
 
 
50
  # Switch to non-root user
51
  USER user
52
 
53
  EXPOSE 7860
54
 
55
+ # Start ttyd on port 7860 to provide a web-based terminal
56
+ CMD ttyd -p 7860 bash