alpine-zdt-images/packer.conf

109 lines
3.2 KiB
Plaintext

# This Packer config file is in HOCON, and is converted to JSON at build time.
# https://github.com/lightbend/config/blob/master/HOCON.md
# vim: ts=2 et:
builders = [
{
type = "amazon-ebssurrogate"
### Builder Instance Details
region = "{{user `build_region`}}"
subnet_id = "{{user `build_subnet`}}"
instance_type = "{{user `build_instance_type`}}"
associate_public_ip_address = "{{user `build_public_ip`}}"
source_ami_filter {
# use the latest Amazon Linux AMI
owners = [ "{{user `build_ami_owner`}}" ]
most_recent = "{{user `build_ami_latest`}}"
filters {
virtualization-type = "hvm"
root-device-type = "ebs"
architecture = "{{user `build_arch`}}"
name = "{{user `build_ami_name`}}"
}
}
launch_block_device_mappings = [
{
volume_type = "gp2"
device_name = "/dev/xvdf"
delete_on_termination = "true"
volume_size = "{{user `ami_volume_size`}}"
}
]
shutdown_behavior = "terminate"
ssh_username = "{{user `build_user`}}"
### AMI Build Details
ami_name = "{{user `ami_name`}}"
ami_description = "{{user `ami_desc`}}"
tags {
Name = "{{user `ami_name`}}"
}
ami_virtualization_type = "hvm"
ami_architecture = "{{user `build_arch`}}" # need packer 1.4.1
ami_root_device {
volume_type = "gp2"
source_device_name = "/dev/xvdf"
device_name = "/dev/xvda"
delete_on_termination = "true"
volume_size = "{{user `ami_volume_size`}}"
}
encrypt_boot = "{{user `ami_encrypt`}}"
ena_support = "true"
sriov_support = "true"
ami_groups = "{{user `ami_access`}}"
ami_regions = "{{user `ami_regions`}}"
}
]
provisioners = [
{
type = "file"
source = "nvme/"
destination = "/tmp"
}
{
type = "shell"
script = "setup-ami"
environment_vars = [
"VERSION={{user `version`}}"
"RELEASE={{user `release`}}"
"REVISION={{user `revision`}}"
"ARCH={{user `arch`}}"
"APK_TOOLS={{user `apk_tools`}}"
"APK_TOOLS_SHA256={{user `apk_tools_sha256`}}"
"ALPINE_KEYS={{user `alpine_keys`}}"
"ALPINE_KEYS_SHA256={{user `alpine_keys_sha256`}}"
"REPOS={{user `repos`}}"
"PKGS={{user `pkgs`}}"
"SVCS={{user `svcs`}}"
"KERNEL_MODS={{user `kernel_modules`}}"
"KERNEL_OPTS={{user `kernel_options`}}"
]
use_env_var_file = "true"
execute_command = "sudo sh -c '. {{.EnvVarFile}} && {{.Path}}'"
}
]
post-processors = [
{
type = "manifest"
output = "profile/{{user `profile`}}/{{user `profile_build`}}/manifest.json"
custom_data {
ami_name = "{{user `ami_name`}}"
ami_desc = "{{user `ami_desc`}}"
profile = "{{user `profile`}}"
profile_build = "{{user `profile_build`}}"
version = "{{user `version`}}"
release = "{{user `release`}}"
arch = "{{user `arch`}}"
revision = "{{user `revision`}}"
end_of_life = "{{user `end_of_life`}}"
}
}
]