FROM ubuntu:22.04 ENV DEBIAN_FRONTEND=noninteractive ENV LANG=en_US.UTF-8 ENV LC_ALL=en_US.UTF-8 RUN apt-get update && apt-get install -y \ locales \ curl \ wget \ git \ vim \ htop \ net-tools \ iputils-ping \ dnsutils \ software-properties-common \ && locale-gen en_US.UTF-8 \ && update-locale LANG=en_US.UTF-8 RUN apt-get install -y \ xfce4 \ xfce4-goodies \ xfce4-terminal \ xfce4-panel \ xfce4-session \ xfce4-settings \ xfdesktop4 \ xfwm4 \ xfce4-appfinder \ thunar \ mousepad \ xfce4-screenshooter \ xfce4-taskmanager RUN apt-get install -y \ novnc \ websockify \ python3-numpy \ python3-websockify RUN apt-get install -y \ tigervnc-standalone-server \ tigervnc-common RUN apt-get install -y \ firefox \ chromium-browser \ python3 \ python3-pip \ build-essential \ sudo \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* RUN useradd -m -s /bin/bash user && \ echo 'user:password' | chpasswd && \ adduser user sudo RUN mkdir -p /home/user/.vnc && \ echo '#!/bin/sh' > /home/user/.vnc/xstartup && \ echo 'unset SESSION_MANAGER' >> /home/user/.vnc/xstartup && \ echo 'unset DBUS_SESSION_BUS_ADDRESS' >> /home/user/.vnc/xstartup && \ echo 'exec /usr/bin/startxfce4 &' >> /home/user/.vnc/xstartup && \ chmod +x /home/user/.vnc/xstartup RUN chown -R user:user /home/user EXPOSE 7080 RUN echo '#!/bin/bash\n\ set -e\n\ \n\ echo "Starting Ubuntu Desktop..."\n\ \n\ mkdir -p /home/user/.vnc\n\ echo "password" | vncpasswd -f > /home/user/.vnc/passwd\n\ chmod 600 /home/user/.vnc/passwd\n\ \n\ echo "Starting VNC server..."\n\ vncserver :1 -geometry 1280x720 -depth 24\n\ \n\ echo "Waiting for VNC server to start..."\n\ sleep 5\n\ \n\ echo "Starting noVNC..."\n\ websockify --web=/usr/share/novnc/ 7080 localhost:5901 &\n\ \n\ echo "Desktop ready! Access at http://localhost:7080"\n\ echo "Press Ctrl+C to stop"\n\ \n\ trap "echo Shutting down...; vncserver -kill :1; exit 0" SIGTERM SIGINT\n\ \n\ while true; do\n\ sleep 1\n\ done' > /startup.sh && chmod +x /startup.sh USER user WORKDIR /home/user CMD ["/startup.sh"]