Files
vms/Makefile

24 lines
594 B
Makefile

.PHONY: run
IMAGE = packer/output/ubuntu-noble.qcow2
SSH_PORT ?= 2222
run:
qemu-system-x86_64 \
-m 2G \
-smp 2 \
--accel kvm \
-drive file=$(IMAGE),format=qcow2 \
-netdev user,id=net0,hostfwd=tcp::$(SSH_PORT)-:22 \
-device virtio-net-pci,netdev=net0 \
-nographic
clean:
@rm -rf packer/output/
build:
rm -f packer/key/packer packer/key/packer.pub
ssh-keygen -f packer/key/packer -t ed25519 -N "" -q
trap 'rm -f packer/key/packer packer/key/packer.pub' EXIT; \
cd packer && packer init . && packer validate . && packer build -var ssh_public_key="$$(cat key/packer.pub)" .