Created
March 16, 2015 13:05
-
-
Save JehandadK/ff97be63ccc46bfb8a7e to your computer and use it in GitHub Desktop.
Packer script for creating a golden image with latest nodejs(but configurable using "n"), npm and nginx
This file contains 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": "", | |
"aws_secret_key": "" | |
}, | |
"builders": [{ | |
"type": "amazon-ebs", | |
"access_key": "{{user `aws_access_key`}}", | |
"secret_key": "{{user `aws_secret_key`}}", | |
"region": "eu-west-1", | |
"source_ami": "ami-9d23aeea", | |
"instance_type": "t2.micro", | |
"ssh_username": "ec2-user", | |
"ami_name": "nodejs-latest-amazon {{timestamp}}" | |
}], | |
"provisioners": [ | |
{ | |
"type": "shell", | |
"inline": [ | |
"sudo yum -y update", | |
"sudo yum -y install gcc-c++ make", | |
"sudo yum -y install openssl-devel", | |
"sudo yum -y install git", | |
"sudo yum -y install nginx", | |
"git clone git://github.com/joyent/node.git ~/node", | |
"cd ~/node", | |
"git checkout v0.10.37", | |
"./configure", | |
"make", | |
"sudo make install", | |
"node -v", | |
"git clone https://github.com/npm/npm.git ~/npm", | |
"cd ~/npm", | |
"git checkout v2.7.1", | |
"sudo make install", | |
"npm -v", | |
"sudo npm install -g pm2 gulp nodemon forever bower n" | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wouldn't using nvm or n or similar solutions would be preferable then reinventing the wheel?