-
Notifications
You must be signed in to change notification settings - Fork 1
/
image.pkr.hcl
39 lines (31 loc) · 1.32 KB
/
image.pkr.hcl
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
/* Alta3 Research | [email protected]
Packer - Example template using HCL to build an Ubuntu Docker image */
/* Packer Block - Contains Packer settings, including Packer version
as well as the required plugins. Anyone can write a plugin (GoLang)
Alta3 Research has an introduction to GoLang course (5 days) */
# The "firecracker" block is an intentional error, the line should read as:
# packer {
packer {
required_plugins {
// The Docker Builder (plugin) - built, maintained, and distributed by HashiCorp
docker = {
version = ">= 0.0.7"
// only necessary when requiring a plugin outside the HashiCorp domain
source = "github.com/hashicorp/docker"
}
}
}
/* Source Block - Configures the builder plugin, which is invoked by the Build Block. In the following example,
the Builder TYPE is "docker", and the Builder NAME is "ubuntu". */
// source "TYPE" "NAME"
source "docker" "ubuntu" {
image = "ubuntu:xenial" //
commit = true
}
/* Build Block - This is what to do with the Docker container after it launches. In more detailed examples, we can use the Provision Block and Post-Process Block to add additional provisioning steps. */
build {
name = "learn-packer"
sources = [
"source.docker.ubuntu" // matches source "docker" "ubuntu" {}
]
}