FROM ubuntu:22.04 # Prevent interactive prompts during build ENV DEBIAN_FRONTEND=noninteractive # Install desktop environment, noVNC, and tools RUN apt-get update && apt-get install -y \ xfce4 xfce4-goodies \ chromium-browser \ tigervnc-standalone-server \ novnc websockify \ curl python3 \ && apt-get clean && rm -rf /var/lib/apt/lists/* # Create a non-root user (Hugging Face requirement) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user ENV PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # Set VNC password (standard: 'headless') RUN mkdir -p $HOME/.vnc && \ echo "headless" | vncpasswd -f > $HOME/.vnc/passwd && \ chmod 600 $HOME/.vnc/passwd # Create a startup script to launch Xvnc and noVNC on port 7860 RUN echo '#!/bin/bash\n\ vncserver :1 -geometry 1280x800 -depth 24\n\ /usr/share/novnc/utils/launch.sh --vnc localhost:5901 --listen 7860' > $HOME/startup.sh && \ chmod +x $HOME/startup.sh # Hugging Face looks for port 7860 EXPOSE 7860 CMD ["/home/user/startup.sh"]