forked from compiler-explorer/infra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
packer.json
71 lines (69 loc) · 2.21 KB
/
packer.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
{
"builders": [
{
"type": "amazon-ebs",
"region": "us-east-1",
"access_key": "{{user `MY_ACCESS_KEY`}}",
"secret_key": "{{user `MY_SECRET_KEY`}}",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "ubuntu/images/*ubuntu-bionic-18.04-amd64-server-*",
"root-device-type": "ebs"
},
"owners": ["099720109477"],
"most_recent": true
},
"instance_type": "t2.medium",
"ssh_username": "ubuntu",
"ami_name": "compiler-explorer packer 18.04 @ {{timestamp}}",
"associate_public_ip_address": true,
"iam_instance_profile": "XaniaBlog",
"vpc_id": "vpc-17209172",
"security_group_id": "sg-f53f9f80",
"subnet_id": "subnet-1df1e135",
"ami_block_device_mappings": [
{
"device_name": "/dev/sda1",
"volume_size": 6,
"delete_on_termination": true,
"volume_type": "standard"
}
],
"launch_block_device_mappings": [
{
"device_name": "/dev/sda1",
"volume_size": 10,
"delete_on_termination": true,
"volume_type": "standard"
}
]
}
],
"variables": {
"MY_ACCESS_KEY": "",
"MY_SECRET_KEY": ""
},
"provisioners": [
{ "type": "file", "source": "packer", "destination": "/home/ubuntu/" },
{
"type": "shell",
"execute_command" : "{{ .Vars }} sudo -E sh '{{ .Path }}'",
"inline": [
"set -e",
"while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for cloud-init...'; sleep 1; done",
"export DEBIAN_FRONTEND=noninteractive",
"mkdir -p /root/.ssh",
"cp /home/ubuntu/packer/known_hosts /root/.ssh/",
"cp /home/ubuntu/packer/known_hosts /home/ubuntu/.ssh/",
"echo 'GOOGLE_API_KEY={{user `GOOGLE_API_KEY`}}' > /env",
"rm -rf /home/ubuntu/packer",
"apt-get -y update",
"apt-get -y install git",
"git clone https://github.com/mattgodbolt/compiler-explorer-image.git /compiler-explorer-image",
"cd /compiler-explorer-image",
"env PACKER_SETUP=yes bash setup.sh 2>&1 | tee /tmp/setup.log"
]
}
]
}