Download Dockerfile from abhy60098/vm: direct link, hf CLI and curl.
- Browser
- Download file 1.41 kB
-
https://huggingface.co/spaces/abhy60098/vm/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/abhy60098/vm/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/abhy60098/vm/resolve/main/Dockerfile
1.41 kB
| FROM ubuntu:22.04 | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # Install QEMU hardware emulators and noVNC web proxy | |
| RUN apt-get update && apt-get install -y \ | |
| qemu-system-x86 \ | |
| qemu-utils \ | |
| novnc \ | |
| websockify \ | |
| wget \ | |
| curl \ | |
| sudo \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN useradd -m -u 1000 vmuser && \ | |
| echo "vmuser ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | |
| RUN ln -s /usr/share/novnc/vnc.html /usr/share/novnc/index.html | |
| USER vmuser | |
| WORKDIR /home/vmuser | |
| # Download a lightweight Linux ISO to boot (Example: Tiny Core Linux) | |
| RUN wget -O /home/vmuser/os.iso http://www.tinycorelinux.net/14.x/x86_64/release/CorePure64-14.0.iso | |
| # Create Virtual Hard Drive (10 GB) | |
| RUN qemu-img create -f qcow2 /home/vmuser/hdd.qcow2 10G | |
| # Startup script to run QEMU with built-in VNC, then link it to noVNC on port 7860 | |
| RUN echo '#!/bin/bash\n\ | |
| # Run QEMU Virtual Machine with 2 Cores and 2GB RAM\n\ | |
| qemu-system-x86_64 \\\n\ | |
| -m 2048M \\\n\ | |
| -smp 2 \\\n\ | |
| -hda /home/vmuser/hdd.qcow2 \\\n\ | |
| -cdrom /home/vmuser/os.iso \\\n\ | |
| -boot d \\\n\ | |
| -vnc localhost:0 \\\n\ | |
| -device e1000,netdev=net0 \\\n\ | |
| -netdev user,id=net0 \\\n\ | |
| -nodefaults &\n\ | |
| \n\ | |
| sleep 2\n\ | |
| # Expose the QEMU VNC display over web port 7860\n\ | |
| websockify --web=/usr/share/novnc/ 7860 localhost:5900\n\ | |
| ' > /home/vmuser/start.sh | |
| RUN chmod +x /home/vmuser/start.sh | |
| EXPOSE 7860 | |
| CMD ["/home/vmuser/start.sh"] |