FROM ubuntu:22.04 # Prevent interactive prompts during installation ENV DEBIAN_FRONTEND=noninteractive # Install XFCE, VNC server, noVNC, and dependencies RUN apt-get update && apt-get install -y \ xfce4 xfce4-goodies \ tightvncserver \ novnc python3-websockify \ curl \ && apt-get clean # Set up global environment variables for noVNC ENV HOME=/root \ USER=root \ RESOLUTION=1920x1080 WORKDIR /root # Create a startup script to handle scaling and display RUN echo "#!/bin/bash\n\ export DISPLAY=:1\n\ rm -rf /tmp/.X1-lock /tmp/.X11-unix/X1\n\ vncserver :1 -geometry \$RESOLUTION -depth 24\n\ # Start noVNC with 'resize=remote' to scale to browser window\n\ /usr/share/novnc/utils/launch.sh --vnc localhost:5901 --listen 7860 --vnc localhost:5901\n" > /entrypoint.sh && chmod +x /entrypoint.sh # Hugging Face Spaces uses port 7860 EXPOSE 7860 CMD ["/entrypoint.sh"]