feat: first commit
- add base image for docker and incus - manage images for almalinux 8.10 and 9.5 - replace all existing docker build repos
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
build {
|
||||
name = local.build_name
|
||||
sources = [
|
||||
"source.docker.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-processors {
|
||||
post-processor "docker-tag" {
|
||||
repository = "${var.docker_server}/unkin/${var.os_name}${var.os_version_major}-${var.os_image}"
|
||||
tags = ["latest", var.date]
|
||||
}
|
||||
|
||||
dynamic "post-processor" {
|
||||
for_each = local.is_master ? [1] : []
|
||||
labels = ["docker-push"]
|
||||
content {
|
||||
login = true
|
||||
login_server = var.docker_server
|
||||
login_username = var.docker_username
|
||||
login_password = var.docker_password
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
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}')"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user