{ "variables": { "accelerator": "kvm", "img_name": "alpine-virt-3.18.4" }, "builders": [ { "communicator": "none", "type": "qemu", "accelerator": "{{ user `accelerator` }}", "use_default_display": true, "iso_url": "https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/x86_64/alpine-virt-3.18.4-x86_64.iso", "iso_checksum": "24d79bc148c05a864c2914dfa41a6ffbf808973e44de88c7700d30b4517965b2", "http_directory": "./files", "vm_name": "{{ user `img_name` }}.img", "disk_size": "200M", "format": "raw", "qemu_img_args": { "create": ["-o", "preallocation=off"] }, "disk_interface": "virtio", "disk_discard": "unmap", "boot_wait": "15s", "boot_key_interval": "20ms", "boot_keygroup_interval": "100ms", "boot_command": [ "root", "ifconfig lo up", "ifconfig eth0 up && udhcpc -i eth0", "wget -q http://{{ .HTTPIP }}:{{ .HTTPPort }}/alpine.conf && setup-alpine -e -f alpine.conf", "wget -q http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.sh && chmod +x install.sh && ./install.sh", "poweroff" ] } ], "post-processors": [ { "type": "shell-local", "inline": [ "qemu-img convert -c -O qcow2 output-qemu/{{ user `img_name` }}.img output-qemu/{{ user `img_name` }}.qcow2", "rm output-qemu/{{ user `img_name` }}.img" ] } ] }