dock / Dockerfile
dracoox's picture
Update Dockerfile
c265acc verified
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive LANG=en_US.UTF-8
Install system packages including LXDE and XRDP
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
lxde
xrdp &&
locale-gen en_US.UTF-8 &&
apt clean && rm -rf /var/lib/apt/lists/*
Configure XRDP to use LXDE session
RUN sed -i 's|port=3389|port=3389|g' /etc/xrdp/xrdp.ini &&
echo "lxsession -s LXDE -e LXDE" > /etc/xrdp/startwm.sh &&
chmod +x /etc/xrdp/startwm.sh
Install Node.js v22 and npm
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - &&
apt update && apt install -y nodejs &&
npm install -g npm &&
apt clean && rm -rf /var/lib/apt/lists/*
Install speedtest-cli
RUN pip3 install --no-cache-dir speedtest-cli
Create user 'draco' with sudo rights and fixed UID
RUN useradd -m -s /bin/bash -u 1000 draco &&
echo "draco:draco" | chpasswd &&
usermod -aG sudo 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
USER draco WORKDIR /home/draco
Create tmate auto-reconnect launcher
RUN cat << 'EOF' > run_tmate.sh #!/bin/bash while true; do echo "[tmate-log] Launching new tmate session..." | tee tmate.txt tmate -S /tmp/tmate.sock new-session -d tmate -S /tmp/tmate.sock wait tmate-ready echo "[tmate-log] SSH: $(tmate -S /tmp/tmate.sock display -p "#{tmate_ssh}")" | tee -a tmate.txt echo "[tmate-log] Web: $(tmate -S /tmp/tmate.sock display -p "#{tmate_web}")" | tee -a tmate.txt echo "[tmate-log] Monitoring connection..." | tee -a tmate.txt while pgrep -f "tmate -S /tmp/tmate.sock" > /dev/null; do sleep 5; done echo "[tmate-log] ⚠️ Connection lost. Reconnecting in 5 seconds..." | tee -a tmate.txt sleep 5 done EOF RUN chmod +x run_tmate.sh
Expose RDP and Hugging Face web port
EXPOSE 3389 7890
Start tmate loop and simple HTTP server on port 7890
CMD ["bash", "-c", "./run_tmate.sh & python3 -m http.server 7890"]