FROM ubuntu:22.04 ENV DEBIAN_FRONTEND=noninteractive ENV HOSTNAME=Nobita # ----------------------------- # Install Required Packages (Added qemu-utils for Disk Resizing) # ----------------------------- RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ curl \ wget \ git \ sudo \ qemu-system-x86 \ qemu-utils \ cloud-image-utils \ openssh-client \ htop \ neovim \ && rm -rf /var/lib/apt/lists/* # ----------------------------- # Install code-server # ----------------------------- RUN curl -fsSL https://code-server.dev/install.sh | sh # ----------------------------- # Create VM Directory & Download Image # ----------------------------- WORKDIR /workspace RUN mkdir -p /vm/debian13 RUN wget https://cloud.debian.org/images/cloud/trixie/daily/latest/debian-13-generic-amd64-daily.qcow2 \ -O /vm/debian13/debian13.qcow2 # ----------------------------- # ZERO ERROR STORAGE: Resize Virtual Disk to 35GB # ----------------------------- RUN qemu-img resize /vm/debian13/debian13.qcow2 35G # ----------------------------- # Proper Cloud-Init Config (Auto-Growpart Injected) # ----------------------------- RUN cat < /vm/debian13/user-data #cloud-config ssh_pwauth: true disable_root: false # Paksa OS expand root partition ke 35GB saat booting growpart: mode: auto devices: ['/'] ignore_growroot_disabled: false chpasswd: list: | root:root nn:nn expire: false users: - default - name: nn groups: sudo shell: /bin/bash sudo: ALL=(ALL) ALL EOF RUN cat < /vm/debian13/meta-data instance-id: debian13 local-hostname: debian13 EOF RUN cloud-localds /vm/debian13/seed.iso \ /vm/debian13/user-data \ /vm/debian13/meta-data # ----------------------------- # Expose Ports # ----------------------------- EXPOSE 7860 2222 # ----------------------------- # Smart Startup (VirtIO Accelerated + Auto Specs) # ----------------------------- CMD bash -c "\ TOTAL_RAM=\$(awk '/MemTotal/ {print int(\$2/1024)}' /proc/meminfo); \ VM_RAM=\$((TOTAL_RAM*80/100)); \ CPU_CORES=\$(nproc); \ echo \"[AQSO ARCHITECTURE] Detected Host RAM: \$TOTAL_RAM MB\"; \ echo \"[AQSO ARCHITECTURE] Allocating VM RAM: \$VM_RAM MB (80%)\"; \ echo \"[AQSO ARCHITECTURE] Detected CPU Cores: \$CPU_CORES\"; \ qemu-system-x86_64 \ -machine q35 \ -cpu max \ -m \$VM_RAM \ -smp \$CPU_CORES \ -drive file=/vm/debian13/debian13.qcow2,format=qcow2,if=virtio \ -drive file=/vm/debian13/seed.iso,format=raw,if=virtio \ -netdev user,id=vnet,hostfwd=tcp::2222-:22 \ -device virtio-net-pci,netdev=vnet \ -nographic & \ code-server --bind-addr 0.0.0.0:7860 --auth none"