aboutsummaryrefslogtreecommitdiff
path: root/packer.conf
blob: 513f0939a78e03fc6f1352085790ebb15a6f50a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
builders = [
  {
    type = "amazon-ebssurrogate"

    ### Builder Instance Details

    region                      = "{{user `build_region`}}"
    subnet_id                   = "{{user `build_subnet`}}"
    security_group_id           = "{{user `build_security_group`}}"
    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`}}"
      }
    ]
    ssh_username = "{{user `build_user`}}"

    ### AMI Build Details

    ami_name =
      "{{user `ami_name_prefix`}}{{user `release`}}-{{user `arch`}}-{{user `revision`}}{{user `ami_name_suffix`}}"
    ami_description =
      "{{user `ami_desc_prefix`}}{{user `release`}} {{user `arch`}} {{user `revision`}} {{user `ami_desc_suffix`}}"
    ami_virtualization_type = "hvm"
    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.sh"
    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_build`}}/manifest.json"
    custom_data {
      profile       = "{{user `profile`}}"
      build         = "{{user `profile_build`}}"
      arch          = "{{user `arch`}}"
      version       = "{{user `version`}}"
      release       = "{{user `release`}}"
      revision      = "{{user `revision`}}"
      end_of_life   = "{{user `end_of_life`}}"
    }
  }
]