- add base image for docker and incus - manage images for almalinux 8.10 and 9.5 - replace all existing docker build repos
61 lines
1.7 KiB
HCL
61 lines
1.7 KiB
HCL
build {
|
|
name = local.build_name
|
|
sources = [
|
|
"source.incus.os"
|
|
]
|
|
|
|
# pre-file-copy scripts
|
|
provisioner "shell" {
|
|
inline = var.scripts_pre_file_copy
|
|
}
|
|
|
|
# Deploy files from the image directory -> root of machine
|
|
provisioner "file" {
|
|
source = var.deploy_files_from_image ? "./files/" : ""
|
|
destination = "/"
|
|
}
|
|
|
|
# Deploy files from the common directory -> root of machine
|
|
provisioner "file" {
|
|
source = var.deploy_files_from_common ? "../../../../files/${var.os_name}/${var.os_image}/" : ""
|
|
destination = "/"
|
|
}
|
|
|
|
# post-file-copy scripts
|
|
provisioner "shell" {
|
|
inline = var.scripts_post_file_copy
|
|
}
|
|
|
|
# pre-packages scripts
|
|
provisioner "shell" {
|
|
inline = var.scripts_pre_packages
|
|
}
|
|
|
|
# manage dnf/packages
|
|
provisioner "shell" {
|
|
inline = [
|
|
"dnf install -y ${join(" ", var.packages)}"
|
|
]
|
|
}
|
|
|
|
# post-packages scripts
|
|
provisioner "shell" {
|
|
inline = var.scripts_post_packages
|
|
}
|
|
|
|
# final scripts
|
|
provisioner "shell" {
|
|
inline = var.scripts_final
|
|
}
|
|
|
|
post-processor "shell-local" {
|
|
inline = [
|
|
"incus image alias delete local:${local.incus_base_name}/latest || true",
|
|
"incus image alias delete local:${local.incus_base_name}/${var.date} || true",
|
|
"incus image info local:${local.incus_output_image} | grep Fingerprint | awk '{print $2}'",
|
|
"incus image alias create local:${local.incus_base_name}/latest $(incus image info local:${local.incus_output_image} | grep Fingerprint | awk '{print $2}')",
|
|
"incus image alias create local:${local.incus_base_name}/${var.date} $(incus image info local:${local.incus_output_image} | grep Fingerprint | awk '{print $2}')"
|
|
]
|
|
}
|
|
}
|