FROM ubuntu:22.04 ENV DEBIAN_FRONTEND=noninteractive # Install required packages including your requested extras RUN apt update && apt upgrade -y && \ apt install -y \ sudo \ curl \ wget \ git \ gnupg \ openssh-client \ neofetch \ tmate \ python3 \ python3-pip \ ca-certificates \ software-properties-common \ build-essential \ procps \ xz-utils \ net-tools \ make \ ffmpeg \ nano \ vim \ htop \ unzip \ zip \ iputils-ping \ tree \ lsof \ netcat \ tmux \ locales && \ locale-gen en_US.UTF-8 # Clean up RUN apt clean && rm -rf /var/lib/apt/lists/* # Install Node.js v22 and npm RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \ apt install -y nodejs && npm install -g npm # Install speedtest-cli via pip RUN pip3 install speedtest-cli # Create user 'draco' with password and sudo rights RUN useradd -m -s /bin/bash draco && echo "draco:draco" | chpasswd && usermod -aG sudo draco RUN usermod -u 1000 draco # Setup SSH keys for draco user RUN mkdir -p /home/draco/.ssh && \ ssh-keygen -t rsa -f /home/draco/.ssh/id_rsa -N '' && \ chown -R draco:draco /home/draco/.ssh # Switch to draco user USER draco WORKDIR /home/draco # Create the tmate launcher script that will run in a loop RUN echo '#!/bin/bash\n\ while true; do\n\ echo "[tmate-log] Launching new tmate session..." | tee /home/draco/tmate.txt;\n\ tmate -S /tmp/tmate.sock new-session -d;\n\ tmate -S /tmp/tmate.sock wait tmate-ready;\n\ echo "[tmate-log] Session Ready: $(tmate -S /tmp/tmate.sock display -p \"#{tmate_ssh}\")" | tee -a /home/draco/tmate.txt;\n\ echo "[tmate-log] Web URL: $(tmate -S /tmp/tmate.sock display -p \"#{tmate_web}\")" | tee -a /home/draco/tmate.txt;\n\ echo "[tmate-log] Monitoring connection..." | tee -a /home/draco/tmate.txt;\n\ while pgrep -f "tmate -S /tmp/tmate.sock" > /dev/null; do sleep 5; done;\n\ echo "[tmate-log] ⚠️ Connection lost. Reconnecting in 5 seconds..." | tee -a /home/draco/tmate.txt;\n\ sleep 5;\n\ done\n' > /home/draco/run_tmate.sh RUN chmod +x /home/draco/run_tmate.sh EXPOSE 7860 CMD bash -c "/home/draco/run_tmate.sh & python3 -m http.server 7860"