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:
2025-01-11 20:50:07 +11:00
commit ff19688dd2
41 changed files with 731 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
locals {
build_name = "${var.os_name}_${var.os_version_full}_${var.os_image}"
sources = [
var.use_docker ? "source.docker.os" : null,
var.use_incus ? "source.incus.os" : null
]
incus_base_name = "${var.os_name}${var.os_version_major}/${var.os_image}"
incus_output_image = "${local.incus_base_name}/${var.suffix}"
is_master = "${var.git_branch}" == "master"
}
+12
View File
@@ -0,0 +1,12 @@
packer {
required_plugins {
docker = {
version = ">= 1.1.1"
source = "github.com/hashicorp/docker"
}
incus = {
source = "github.com/bketelsen/incus"
version = "~> 1"
}
}
}
+11
View File
@@ -0,0 +1,11 @@
source "docker" "os" {
image = var.docker_source
commit = true
changes = var.docker_changes
}
source "incus" "os" {
image = var.incus_source
output_image = local.incus_output_image
publish_remote_name = "local"
}
+118
View File
@@ -0,0 +1,118 @@
variable "use_docker" {
type = bool
default = true
}
variable "use_incus" {
type = bool
default = false
}
variable "os_name" {
description = "The name of the operating system."
type = string
default = env("OS_NAME")
}
variable "os_version_full" {
description = "The operating system full version number."
type = string
default = env("OS_VERSION_FULL")
}
variable "os_image" {
description = "The type of image to be built."
type = string
default = env("OS_IMAGE")
}
variable "os_version_major" {
description = "The operating system major version number."
type = string
default = env("OS_VERSION_MAJOR")
}
variable "date" {
description = "The current date in yyymmdd format."
type = string
default = env("DATE")
}
variable "packages" {
description = "List of packages to install."
type = list(string)
default = ["git"]
}
variable "scripts_pre_file_copy" {
description = "Scripts to run before the file copy process."
type = list(string)
default = ["true"]
}
variable "scripts_post_file_copy" {
description = "Scripts to run after the file copy process."
type = list(string)
default = ["true"]
}
variable "scripts_pre_packages" {
description = "Scripts to run before the package install process."
type = list(string)
default = ["true"]
}
variable "scripts_post_packages" {
description = "Scripts to run after the package install process."
type = list(string)
default = ["true"]
}
variable "scripts_final" {
description = "Scripts to run at the end of the build process."
type = list(string)
default = ["true"]
}
variable "deploy_files_from_image" {
description = "Whether to deploy files from images directory."
type = bool
default = false
}
variable "deploy_files_from_common" {
description = "Whether to deploy files from the common os name/image path."
type = bool
default = false
}
variable "docker_username" {
description = "The username to use when logging into docker registry."
type = string
default = env("DOCKER_USERNAME")
}
variable "docker_password" {
description = "The password to use when logging into docker registry."
type = string
default = env("DOCKER_PASSWORD")
}
variable "docker_server" {
description = "The docker registry to login to."
type = string
default = env("DOCKER_SERVER")
}
variable "docker_changes" {
description = "A list of metadata changes, e.g. CMD, WORKDIR, ENV, etc."
type = list(string)
default = []
}
variable "docker_source" {
description = "The docker_source image for the build."
type = string
default = env("DOCKER_SOURCE")
}
variable "incus_source" {
description = "The incus_source image for the build."
type = string
default = env("INCUS_SOURCE")
}
variable "incus_output_image" {
description = "The output image name for incus images for the build."
type = string
default = env("INCUS_OUTPUT_IMAGE")
}
variable "suffix" {
description = "The output image suffix. This should be unique per-run."
type = string
default = env("SUFFIX")
}
variable "git_branch" {
description = "The current git branch."
type = string
default = env("GIT_BRANCH")
}