-
-
Save Puneeth-n/1d52456c2143b1f597906eb0d5ac48ea to your computer and use it in GitHub Desktop.
Packer Template for Ubuntu 16.04 with Docker Compose as Amazon Machine Image (AMI)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"variables": { | |
"aws_access_key": "{{env `AWS_ACCESS_KEY`}}", | |
"aws_secret_key": "{{env `AWS_SECRET_KEY`}}" | |
}, | |
"builders": [ | |
{ | |
"type": "amazon-ebs", | |
"access_key": "{{user `aws_access_key`}}", | |
"secret_key": "{{user `aws_secret_key`}}", | |
"region": "eu-central-1", | |
"source_ami_filter": { | |
"filters": { | |
"name": "*ubuntu-xenial-16.04-amd64-server-*", | |
"root-device-type": "ebs" | |
}, | |
"owners": ["099720109477"], | |
"most_recent": true | |
}, | |
"instance_type": "t2.micro", | |
"ssh_username": "ubuntu", | |
"ami_name": "Ubuntu 16.04 with Docker Compose", | |
} | |
], | |
"provisioners": [ | |
{ | |
"type": "shell", | |
"inline": [ | |
"sudo apt-get update && sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y", | |
"sudo groupadd docker", | |
"sudo gpasswd -a ubuntu docker", | |
"curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -", | |
"sudo add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable\"", | |
"sudo apt-get update && sudo apt-get install docker-ce -y", | |
"sudo curl -L \"https://github.com/docker/compose/releases/download/1.11.2/docker-compose-$(uname -s)-$(uname -m)\" -o /usr/local/bin/docker-compose", | |
"sudo chmod +x /usr/local/bin/docker-compose" | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment