-
Notifications
You must be signed in to change notification settings - Fork 0
/
packer-artifice.json
72 lines (71 loc) · 1.93 KB
/
packer-artifice.json
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
{
"variables": {
"gce_from": "debian-9",
"gce_zone": "europe-west4-c",
"gce_project": "{{env `GOOGLE_PROJECT`}}",
"gce_auth": "{{env `GOOGLE_CREDENTIALS`}}",
"gce_machine": "custom-1-1024",
"gce_user": "cloud"
},
"builders": [
{
"name": "gce",
"type": "googlecompute",
"disk_type": "pd-ssd",
"project_id": "{{user `gce_project`}}",
"account_file": "{{user `gce_auth`}}",
"ssh_username": "{{user `gce_user`}}",
"machine_type": "{{user `gce_machine`}}",
"source_image_family": "{{user `gce_from`}}",
"zone": "{{user `gce_zone`}}",
"image_name": "{{user `from`}}"
}
],
"provisioners": [
{
"type": "file",
"source": "/usr/bin/packer",
"destination": "/tmp/packer"
},
{
"type": "file",
"source": "container",
"destination": "/tmp"
},
{
"type": "shell",
"execute_command": "echo 'packer' | sudo -S bash -c '{{ .Vars }} {{ .Path }}'",
"inline": [
"apt-get -qq install -y apt-transport-https",
"curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -",
"echo 'deb [arch=amd64] http://download.docker.com/linux/debian stretch stable' | tee /etc/apt/sources.list.d/docker.list",
"apt-get update",
"apt-get -qq install -y docker-ce",
"cd /tmp/container",
"/tmp/packer build container-packer.json"
]
},
{
"type": "file",
"source": "/tmp/container/alpine.tar",
"destination": "alpine.tar",
"direction": "download"
}
],
"post-processors": [
[
{
"type": "artifice",
"files": ["alpine.tar"]
},
{
"type": "compress",
"output": "alpine.tar.gz"
},
{
"type": "shell-local",
"inline": [ "du -sh alpine.tar.gz"]
}
]
]
}