# Use NVIDIA CUDA base for GPU support FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04 # Set non-interactive installation ENV DEBIAN_FRONTEND=noninteractive # 1. Install System Dependencies RUN apt-get update && apt-get install -y \ wget \ curl \ unzip \ xz-utils \ xvfb \ libgbm1 \ libgtk-3-0 \ libnss3 \ libasound2 \ pulseaudio \ python3 \ python3-pip \ dbus-x11 \ ffmpeg \ ca-certificates \ ssl-cert \ libswitch-perl \ libyaml-tiny-perl \ libhash-merge-simple-perl \ liblist-moreutils-perl \ libtry-tiny-perl \ libdatetime-timezone-perl \ # Add 'debconf-utils' to allow us to pre-seed answers debconf-utils \ && rm -rf /var/lib/apt/lists/* # 2. Install KasmVNC (THE NUCLEAR FIX) RUN wget https://github.com/kasmtech/KasmVNC/releases/download/v1.3.1/kasmvncserver_jammy_1.3.1_amd64.deb # --- PRE-SEEDING ANSWERS --- # This block tells the system: "When kasmvncserver asks about 'daemon_user_write', answer 'false' (Option 2)" RUN echo "kasmvncserver kasmvncserver/daemon_user_write boolean false" | debconf-set-selections && \ echo "kasmvncserver kasmvncserver/default_user_write boolean false" | debconf-set-selections # Now we install, and it should see the answer is already there. RUN apt-get install -y ./kasmvncserver_*.deb || apt-get install -f -y && \ rm kasmvncserver_*.deb # 3. Install Python libraries RUN pip3 install requests yt-dlp # 4. Setup User RUN useradd -m -u 1000 user USER user ENV HOME=/home/user WORKDIR $HOME # 5. Download Chromium RUN LAST_CHANGE=$(curl -sS https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2FLAST_CHANGE?alt=media) && \ echo "Downloading Chromium Build: $LAST_CHANGE" && \ wget -q "https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F${LAST_CHANGE}%2Fchrome-linux.zip?alt=media" -O chrome-linux.zip && \ unzip -q chrome-linux.zip && \ rm chrome-linux.zip && \ chmod +x /home/user/chrome-linux/chrome # 6. Prepare Start Script COPY --chown=user start.sh /start.sh RUN chmod +x /start.sh # 7. Expose Port EXPOSE 7860 CMD ["/start.sh"]