The popular open-source contract for web designers and developers by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: October 8th 2015
- Original post
var async = require("async"); | |
var AWS = require("aws-sdk"); | |
var im = require("gm").subClass({imageMagick: true}); | |
var s3 = new AWS.S3(); | |
var path = require("path"); | |
var CONFIG = require("./config.json"); |
FROM ubuntu:14.04 | |
MAINTAINER li0nel | |
USER root | |
# Install CRON | |
RUN apt-get update && apt-get -y install sudo && \ | |
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 && \ | |
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list && \ |
fetch('https://api.hubapi.com/companies/v2/companies/' + inputData.companyId + '?hapikey=' + inputData.hapiKey) | |
.then(function(res) { | |
return res.json(); | |
}) | |
.then(function(body) { | |
var output = {id: inputData.companyId, company: body}; | |
callback(null, output); | |
}) | |
.catch(callback); |
fetch('https://api.hubapi.com/companies/v2/companies/' + inputData.companyId+ '/contacts?hapikey=' + inputData.hapiKey ) | |
.then(function(res) { | |
return res.json(); | |
}) | |
.then(function(body) { | |
var contacts = []; | |
body.contacts.forEach(function(contact) { | |
contact.identities.forEach(function(identity) { | |
identity.identity.forEach(function(i) { | |
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; |
# Create the key pair and extract the private key from the JSON response | |
aws ec2 create-key-pair | |
--key-name=laravelaws | |
--query 'KeyMaterial' | |
--output text > laravelaws.pem | |
# Assign appropriate permissions to the key file for it to be usable | |
chmod 400 laravelaws.pem |
# a certificate in your default region for your web application | |
aws acm request-certificate | |
--domain-name laravelaws.com | |
--idempotency-token=random_string_here | |
--subject-alternative-names *.laravelaws.com | |
# a certificate from us-east-1 specifically for our CloudFront custom domain | |
aws --region us-east-1 acm request-certificate | |
--domain-name laravelaws.com | |
--idempotency-token=random_string_here |
# The get-login command outputs the "docker login" command you need to execute with a temporary token | |
# You can run both directly using eval | |
# The --no-include-email tells get-login not to return the -e option that does not work for all of Docker versions | |
eval $(aws ecr get-login --no-include-email) |
aws configure |
# Building our Nginx Docker image and tagging it with the ECR URL | |
docker build -f Dockerfile-nginx -t YOUR_ECR_REGISTRY_URL_HERE:nginx . | |
docker push YOUR_ECR_REGISTRY_URL_HERE:nginx | |
# Building our Laravel Docker image and tagging it with the ECR URL | |
docker build -t YOUR_ECR_REGISTRY_URL_HERE:laravel . | |
docker push YOUR_ECR_REGISTRY_URL_HERE:laravel |