Skip to content

Commit

Permalink
Add Alpine 3.18
Browse files Browse the repository at this point in the history
  • Loading branch information
amezin committed Jan 21, 2024
1 parent 937e6ec commit dd79f74
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ on:
"fedora39",
"silverblue39",
"opensusetumbleweed",
"alpine319"
"alpine319",
"alpine318"
]
publish:
description: 'Publish to Vagrant Cloud'
Expand Down
72 changes: 72 additions & 0 deletions alpine-3.18.pkr.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
source "qemu" "alpine318" {
iso_url = "https://mirrors.edge.kernel.org/alpine/v3.18/releases/x86_64/alpine-virt-3.18.5-x86_64.iso"
iso_checksum = "file:https://mirrors.edge.kernel.org/alpine/v3.18/releases/x86_64/alpine-virt-3.18.5-x86_64.iso.sha256"
vga = "virtio"
cpus = 2
memory = 2048
headless = var.headless
shutdown_command = "/sbin/poweroff"
qmp_enable = true
disk_discard = "unmap"
http_content = {
"/alpine-answer.sh" = templatefile("${path.root}/alpine-answer.sh", { path = path, hostname = "alpine318" })
"/vagrant.pub" = file("${path.root}/keys/vagrant.pub")
}
ssh_handshake_attempts = 1000
ssh_timeout = "10m"
ssh_username = "root"
ssh_private_key_file = "${path.root}/keys/vagrant"
boot_wait = "1m"
boot_keygroup_interval = "1s"
boot_command = [
"<enter><wait10>",
"root<enter><wait10>",
"setup-interfaces -a -r && ",
"setup-sshd -k 'http://{{ .HTTPIP }}:{{ .HTTPPort }}/vagrant.pub' openssh<enter>",
]
}

build {
sources = [
"source.qemu.alpine318"
]

provisioner "shell" {
inline = [
"setup-alpine -e -f 'http://${build.PackerHTTPAddr}/alpine-answer.sh'",
]

env = {
"ERASE_DISKS" = "/dev/vda"
}
}

provisioner "shell" {
inline = ["reboot"]
expect_disconnect = true
pause_after = "1m"
}

provisioner "shell" {
start_retry_timeout = "10m"
inline = [
"setup-xorg-base",
"setup-desktop gnome",
"apk add qemu-guest-agent spice-vdagent spice-webdavd rsync",
"rc-update add qemu-guest-agent",
"rc-update add spice-vdagentd",
"rc-update add spice-webdavd",
"usermod -p '${bcrypt("vagrant")}' vagrant",
"usermod -p '${bcrypt("vagrant")}' root",
"echo 'permit nopass :vagrant' >/etc/doas.d/vagrant.conf",
"rm -rf /var/cache/apk/*",
]
}

post-processors {
post-processor "vagrant" {
keep_input_artifact = true
vagrantfile_template = "Vagrantfile"
}
}
}

0 comments on commit dd79f74

Please sign in to comment.