code / Dockerfile
dracoox's picture
Update Dockerfile
9a072fd verified
raw
history blame
1.11 kB
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# Update and upgrade using both apt and apt-get
RUN apt update && apt upgrade -y && \
apt-get update && apt-get upgrade -y && \
apt-get install -y \
python3 python3-pip \
nodejs npm \
tmate \
openssh-client \
neofetch \
git \
curl \
procps \
ca-certificates && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Install Telegram bot library
RUN pip3 install --no-cache-dir pytelegrambotapi
# Generate fresh SSH key for tmate
RUN mkdir -p /root/.ssh && \
ssh-keygen -t rsa -f /root/.ssh/id_rsa -N '' && \
chmod 700 /root/.ssh && chmod 600 /root/.ssh/id_rsa
# Create non-root user with UID 1000
RUN useradd -m -u 1000 -s /bin/bash user
# Set environment variables for user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Create dummy file and set working directory
RUN mkdir -p /app && echo "Tmate Session Running..." > /app/index.html
WORKDIR /app
# Switch to non-root user
USER user
EXPOSE 7860
# Start dummy HTTP server and tmate session
CMD python3 -m http.server 7860 & tmate -F