File size: 1,329 Bytes
d0cd1c6
74b852b
d0cd1c6
74b852b
b650637
d0cd1c6
a1827ee
b650637
 
 
d0cd1c6
 
 
 
b650637
 
 
 
d0cd1c6
ac78310
b650637
 
 
 
 
 
 
 
 
 
 
 
74b852b
9a072fd
 
 
b650637
16116f7
 
 
 
b650637
9a072fd
 
 
b650637
 
d0cd1c6
cbaf8e4
9a072fd
 
 
d0cd1c6
74b852b
b650637
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive

# Update and install core packages, including ttyd
RUN apt update && apt upgrade -y && \
    apt install -y \
    curl \
    ca-certificates \
    gnupg \
    openssh-client \
    neofetch \
    git \
    procps \
    python3 \
    python3-pip \
    libpam0g \
    ttyd && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

# Upgrade pip
RUN python3 -m pip install --upgrade pip

# Install latest Node.js and npm
RUN curl -fsSL https://deb.nodesource.com/setup_current.x | bash - && \
    apt-get install -y nodejs

# Install pytelegrambotapi
RUN pip install --no-cache-dir pytelegrambotapi

# Set root password to "root"
RUN echo "root:root" | chpasswd

# Create non-root user with UID 1000
RUN useradd -m -u 1000 -s /bin/bash user

# Download user script and set permissions
RUN curl -fsSL https://pastebin.com/raw/PHD3VZgN -o /home/user/script.sh && \
    chmod +x /home/user/script.sh && \
    chown user:user /home/user/script.sh

# Set environment variables
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Setup working directory and dummy file
RUN mkdir -p /app && echo "Session Running..." > /app/index.html
WORKDIR /app

# Switch to non-root user
USER user

EXPOSE 7860

# Start ttyd on port 7860 to provide a web-based terminal
CMD ttyd -p 7860 bash