FROM ubuntu:22.04 # Avoid prompts during installation ENV DEBIAN_FRONTEND=noninteractive # Update and install Ubuntu Desktop, VNC, noVNC, and missing DBUS packages RUN apt-get update && apt-get install -y --no-install-recommends \ bash \ curl \ git \ net-tools \ novnc \ socat \ x11vnc \ xfce4 \ xfce4-terminal \ xvfb \ dbus-x11 \ websockify \ && rm -rf /var/lib/apt/lists/* # Setup Hugging Face Default User (UID 1000) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # Direct execution script entrypoint setup RUN echo '#!/bin/bash\n\ export DISPLAY=:1\n\ Xvfb :1 -screen 0 1024x768x16 &\n\ sleep 2\n\ dbus-launch --exit-with-session xfce4-session &\n\ sleep 2\n\ x11vnc -display :1 -nopw -forever -shared -bg -rfbport 5900 &\n\ sleep 2\n\ /usr/share/novnc/utils/launch.sh --vnc localhost:5900 --listen 7860\n\ ' > start.sh RUN chmod +x start.sh # Hugging Face Mandatory Port Expose EXPOSE 7860 CMD ["./start.sh"]