code / Dockerfile
dracoox's picture
Update Dockerfile
b650637 verified
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